Function to flip the bits of String
static String flip ( char [ ] s ) { for ( int i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] == '1' ) s [ i ] = '0' ; else s [ i ] = '1' ; } return String . valueOf ( s ) ; }