#Lutece0206. Count Color
Count Color
Migrated from Lutece 206 Count Color
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem.
There is a very long board with length centimeter, is a positive integer, so we can evenly divide the board into segments, and they are labeled by from left to right, each is centimeter long. Now we have to color the board - one segment with only one color. We can do following two operations on the board:
C A B C
Color the board from segment to segment with color .P A B
Output the number of different colors painted between segment and segment (including).
In our daily life, we have very few words to describe a color (red, green, blue, yellow…), so you may assume that the total number of different colors is very small. To make it simple, we express the names of colors as color , color , ... color . At the beginning, the board was painted in color . Now the rest of problem is left to your.
Input
There is only one testcase! First line of input contains (), () and (). Here denotes the number of operations. Following lines, each contains C A B C
or P A B
(here , , are integers, and may be larger than ) as an operation defined previously.
Output
Ouput results of the output operation in order, each line contains a number.
Samples
2 2 4
C 1 1 2
P 1 2
C 2 2 2
P 1 2
2
1
Note
The data used in this problem is unofficial data prepared by standy. So any mistake here does not imply mistake in the offcial judge data.
Resources
POJ Monthly--2006.03.26,dodo