If current string doesn 't  have an entry in the map  then create the entry
if ( it == M . end ( ) ) { vector < int > A ; A . push_back ( i + 1 ) ; M . insert ( make_pair ( temp , A ) ) ; } else { it -> second . push_back ( i + 1 ) ; } } auto it = M . find ( str ) ;