Problem A
Tildes
Languages
en
is
The other day Bjarki was playing one of his many video
games,
During the party people started chatting. Due to the way
Bjarki is starting to get bored watching this process so he starts counting the size of the groups. But every person is so small on the screen it’s actually easier for him to notice the speechbubble form, which indicate a merger of groups. Bjarki gives you two different types of queries. One indicates a speechbubble and the other means Bjarki wants to know the size of a particular group chat.
Input
The first line of the input contains two integers
Output
The output should contain one line containing one integer for each query of the ‘s’ type indicating the size of the specified group.
Sample Input 1 | Sample Output 1 |
---|---|
10 11 t 1 10 t 1 2 t 1 3 s 1 s 2 s 3 s 4 t 5 6 s 5 s 6 s 10 |
4 4 4 1 2 2 4 |
Sample Input 2 | Sample Output 2 |
---|---|
5 11 s 1 t 1 2 s 1 t 1 2 s 1 t 4 5 s 5 t 1 5 s 2 t 3 2 s 3 |
1 2 2 2 4 5 |