Convert lowercase into uppercase until lower = N / 2
if ( Character . isLowerCase ( S . charAt ( i ) ) ) { S = S . substring ( 0 , i ) + ( char ) ( S . charAt ( i ) - 32 ) + S . substring ( i + 1 ) ; moves ++ ; upper ++ ; lower -- ; }