## LCC/Moose '19 Contest 4 J2 - Ping Pong

View as PDF

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 128M

Author:
Problem type

Daniel really enjoys the sport table tennis. However, as school has started and he now can't play during the day, he decided to use words to describe a table tennis rally.

A table tennis rally first must start off with 4 words in order: ping, pong, rally, and on. If it does not start with all 4 of these words in order, then the game will not be valid.

If the rally is valid, the rest of the moves will either be ping, pong or miss, representing when a player has missed and the other player has won the rally. You will be given an integer , which is either 1 or 2, representing who starts the rally. However, if there is never a miss, then the rally is still ongoing. If there is a miss but anything after it, the rally will be considered as invalid as well.

It is guaranteed that all words will be in lowercase characters.

Given actions in total, print the corresponding answer to the rally.

#### Input Specification

The first line will contain two integers, , the number of actions played in the rally, and , the player that serves first.

The next lines will contain one word on each line. The first 4 lines may be any word, while the lines after that (if existing) will only be ping, pong or miss.

#### Output Specification

If the rally is invalid, then print No point. Otherwise, if the rally is valid and someone has missed, print the number of the player who has not missed/won the point, either or . If no one has missed, then print Ongoing.

#### Sample Input 1

7 1
ping
pong
rally
on
ping
pong
miss

#### Sample Output 1

2

#### Explanation for Sample 1

Player 1 misses when it is their turn to hit so it is Player 2's point.

#### Sample Input 2

4 2
ping
pong
rally
done

#### Sample Output 2

No point