CF710F String Set Queries

Description

You should process $ m $ queries over a set $ D $ of strings. Each query is one of three kinds: 1. Add a string $ s $ to the set $ D $ . It is guaranteed that the string $ s $ was not added before. 2. Delete a string $ s $ from the set $ D $ . It is guaranteed that the string $ s $ is in the set $ D $ . 3. For the given string $ s $ find the number of occurrences of the strings from the set $ D $ . If some string $ p $ from $ D $ has several occurrences in $ s $ you should count all of them. Note that you should solve the problem in online mode. It means that you can't read the whole input at once. You can read each query only after writing the answer for the last query of the third type. Use functions fflush in C++ and BufferedWriter.flush in Java languages after each writing in your program.

Input Format

N/A

Output Format

N/A