Driver code
public static void main ( String [ ] args ) { String symbols = " TTFT " ; String operators = " | & ^ " ; StringBuilder S = new StringBuilder ( ) ; int j = 0 ; for ( int i = 0 ; i < symbols . length ( ) ; i ++ ) { S . append ( symbols . charAt ( i ) ) ; if ( j < operators . length ( ) ) S . append ( operators . charAt ( j ++ ) ) ; }