#P1125. [NOIP 2008 提高组] 笨小猴
[NOIP 2008 提高组] 笨小猴
Description
The silly little monkey has a very small vocabulary, so he always struggles with English multiple-choice questions. But he found a method, and experiments show that using this method greatly increases the chance of choosing the correct option.
The method is described as follows: suppose is the number of occurrences of the most frequent letter in a word, and is the number of occurrences of the least frequent letter in the word. If is a prime number, then the silly little monkey considers this a Lucky Word. Such a word is very likely to be the correct answer.
Input Format
A single word containing only lowercase letters, with length less than .
Output Format
Two lines in total. The first line is a string: if the input word is a Lucky Word, output Lucky Word; otherwise, output No Answer.
The second line is an integer: if the input word is a Lucky Word, output the value of ; otherwise, output .
error
Lucky Word
2
olympic
No Answer
0
Hint
[Explanation for Sample Input/Output 1]
In the word error, the most frequent letter appears times, and the least frequent letter appears time. , and is a prime number.
[Explanation for Sample Input/Output 2]
In the word olympic, the most frequent letter appears time, and the least frequent letter appears time. , and is not a prime number.
(The original error in this part has been corrected.)
NOIP 2008 Senior, Problem 1.
Translated by ChatGPT 5
京公网安备 11011102002149号