## LCC/Moose '19 Contest 3 J3 - WELCOME TO MY MINE

View as PDF

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

Author:
Problem type

After more than 3 years of complete dominance, MineCraft Awesome Parodys has a new competitor: Theodore. Since Theodore is bad at writing Minecraft parodies, he has decided to randomly generate them, but that creates a lot of songs not related to Minecraft. You have been tasked with checking to make sure the song lyrics involve enough Minecraft.

Theodore sets out the following rules to determine whether or not the lyrics contain enough Minecraft:

1. Each line must have the word mine and the word craft at least once at some point.
2. The first occurrence of mine must come before the first occurrence of craft in each line.
3. The number of non mine and non craft words should not exceed the number of times mine occurs.

#### Input Specification

The first line contains an integer , the number of lines in the Minecraft parody.

The next lines each contain a line from the minecraft parody. Each line will consist only of lowercase letters and space and will not exceed characters in length.

Note: For the purposes of this problem a word is defined as a collection of letters separated from other words by a space.

#### Output Specification

A single line containing either PROFIT if the song is a Minecraft parody, or cri otherwise.

#### Sample Input 1

2
welcome to my mine
we are mining diamonds

#### Sample Output 1

cri

#### Sample Input 2

1
minecraft

#### Sample Output 2

cri

#### Sample Input 3

2
my mine craft mine
yes i mine craft

#### Sample Output 3

PROFIT