If pattern matches then print the corresponding mapped words
if ( map . ContainsKey ( strr ) ) { List < String > temp = new List < string > ( ) ; temp . AddRange ( map [ strr ] ) ; temp . Add ( arr [ wordPos ] ) ; map [ strr ] = temp ; } else { map . Add ( strr , new List < string > { arr [ wordPos ] } ) ; } }