Citadel Securities interview question

Implement a data structure that can efficiently handle operations X and Y on strings.