NOIP '08 P1 - Silly Monkey

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 256M

Problem types

Silly monkey has a very small vocabulary, so every time he does English multiple-choice questions, he has a headache. But he found a method, and it has been proved by experiments that when using this method to choose options, the chance of choosing the right one is very high!

The specific description of this method is as follows: Suppose \mathit{maxn} is the number of occurrences of the letter that appears the most frequently in the word, and \mathit{minn} is the number of occurrences of the letter that appears the least frequently in the word. If \mathit{maxn}-\mathit{minn} is a prime number, then silly monkey thinks this is a Lucky Word, such a word is likely to be the correct answer.

Input Specification

There is only one line, which is a word consisting of only lower characters (a - z), and the length is at most 100.

Output Specification

Two lines in total, the first line is a string, if the input word is Lucky Word, then output Lucky Word, otherwise output No Answer. The second line is an integer, if the input word is Lucky Word, output the value of \mathit{maxn}-\mathit{minn}, otherwise output 0.

Sample Input 1

error

Sample Output 1

Lucky Word
2

#Explanation of Sample Outpt 1

The letter r that appears the most in the word error appears 3 times, and the letter that appears the least frequently appears once, 3-1=2, and 2 is a prime number.

Sample Input 2

olympic

Sample Output 2

No Answer
0

Explanation of Sample Output 2

The letter that appears the most in the word olympic appears 1 time, and the letter that appears the least frequently appears 1 time, 1-1=0, 0 is not a prime number.


Comments

There are no comments at the moment.