iterating through map to print group
for ( auto it = groupMap . begin ( ) ; it != groupMap . end ( ) ; it ++ ) { vector < int > v = it -> second ; for ( int i = 0 ; i < v . size ( ) ; i ++ ) cout << str [ v [ i ] ] << " ▁ " ; cout << endl ; } }