Tudor, having gone through the ordeal of consuming tapioca pearls, has decided to prepare himself some more tea. Instead of consuming it with tapioca pearls, he instead consumes it with coconut jelly.
Because Tudor still hasn't shaken off drinking tea from his brief stint during the summer in the United States, he consumes his tea with a straw. He begins to consume some tea via the straw. How many distinct chunks of coconut jelly are present in the straw?
Constraints
In tests worth 5 marks, there will be at most one chunk of coconut jelly in the straw.
Input Specification
The input will contain seven lines, each one corresponding to a part of the straw. For our purposes, if two adjacent parts of the straw both contain coconut jelly, they are part of the same chunk.
Each line will contain a single uppercase letter, either a T
to indicate that the vertical cross-section
of that part of the straw will contain only tea or a J
to indicate that it will contain coconut jelly.
Output Specification
Output, on a single line, the number of chunks of coconut jelly currently in the straw.
Sample Input
J
J
T
T
J
J
T
Sample Output
2
Sample Explanation
There's a chunk of coconut jelly at the top of the straw, then Tudor will get to drink some tea. Tudor will then ingest a similarly sized chunk of coconut jelly followed up by a smaller amount of tea.
Comments
cool cool coolio