Function to calculate and return the minimum number of flips to make string valid
public static int minimumMoves ( String s , int K ) { StringBuilder S = new StringBuilder ( s ) ; int N = S . length ( ) ;