map for storing indices of string which are in same group
groupMap = { } NEW_LINE for i in range ( n ) : NEW_LINE INDENT diffStr = getDiffString ( str [ i ] ) NEW_LINE if diffStr not in groupMap : NEW_LINE INDENT groupMap [ diffStr ] = [ i ] NEW_LINE DEDENT else : NEW_LINE INDENT groupMap [ diffStr ] . append ( i ) NEW_LINE DEDENT DEDENT