Tudor, having somehow survived yet another exam season, has decided to celebrate by preparing himself a cup of tea. Little did he know that someone snuck in some tapioca pearls into his tea. Poor Tudor, being forced to consume tapioca pearls with his tea.
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 tapioca pearls is he going to ingest based on the contents of the straw right now?
Constraints
In tests worth 5 marks, there will be at most one pearl in the straw.
Input Specification
The input will contain five lines, each one corresponding to a part of the straw. For our purposes, we will assume that a tapioca pearl, if present, takes up volume equal to exactly one part of the straw.
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 P
to indicate that it will contain a single tapioca pearl.
Output Specification
Output, on a single line, the number of tapioca pearls currently in the straw.
Sample Input
P
P
P
P
P
Sample Output
5
Sample Explanation
Tudor's about to consume five tapioca pearls with the current strawful of tea. How will he survive?
Comments
I am having the same problem using Python 3. I tried using
print(x, end='')
andsys.stdout.write(pearls)
but am still getting the whitespace error.your code passes if you just
print(pearls)
Have you tried putting a newline character at the end of the output?
i.e. don't use
end=''
Ah, there should be a newline character! Thank you, hxxr :) And p!geon!!