## Mock CCC '19 Contest 2 J1 - Tudor Drinks Some Tea

View as PDF

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 1G

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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 consist of 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 contains only tea or a P to indicate that it contains 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?

• commented on Oct. 18, 2019, 11:36 a.m.

I am having the same problem using Python 3. I tried using print(x, end='') and sys.stdout.write(pearls) but am still getting the whitespace error.

• commented on Oct. 18, 2019, 6:10 p.m.

your code passes if you just print(pearls)

• commented on Oct. 18, 2019, 5:14 p.m.

Have you tried putting a newline character at the end of the output?

i.e. don't use end=''

• commented on Oct. 22, 2019, 8:32 a.m. edited

Ah, there should be a newline character! Thank you, hxxr :) And p!geon!!

• commented on Feb. 8, 2019, 1:22 p.m.

what does this mean for the given problem: (Presentation Error, check your whitespace)?

I don't see how and where whitespace should play a factor in solving the question.