Traverse the string , S and push all the vowels to string vow
for ( int i = 0 ; i < n ; i ++ ) { if ( S . charAt ( i ) == ' a ' || S . charAt ( i ) == ' e ' || S . charAt ( i ) == ' i ' || S . charAt ( i ) == ' o ' || S . charAt ( i ) == ' u ' ) { vow = vow . substring ( 0 , vow . length ( ) ) + S . charAt ( i ) ; } }