Eightfold interview question

implement inverted index for strings