Find next word in dict by changing each element from ' a ' to ' z '
for ( int i = 0 ; i < word . size ( ) ; i ++ ) { char s = word [ i ] ; for ( char c = ' a ' ; c <= ' z ' ; c ++ ) { word [ i ] = c ; if ( dict . count ( word ) ) res . push_back ( word ) ; } word [ i ] = s ; } return res ; }