P1125 [NOIP 2008 Senior] Silly Little Monkey
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 $ \text{maxn} $ is the number of occurrences of the most frequent letter in a word, and $ \text{minn} $ is the number of occurrences of the least frequent letter in the word. If $ \text{maxn}-\text{minn} $ 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 $100$.
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 $ \text{maxn}-\text{minn} $; otherwise, output $0$.
Explanation/Hint
[Explanation for Sample Input/Output 1]
In the word `error`, the most frequent letter $ \texttt{r} $ appears $3$ times, and the least frequent letter appears $1$ time. $3-1=2$, and $2$ is a prime number.
[Explanation for Sample Input/Output 2]
In the word `olympic`, the most frequent letter $ \texttt{i} $ appears $1$ time, and the least frequent letter appears $1$ time. $1-1=0$, and $0$ is not a prime number.
(The original error in this part has been corrected.)
NOIP 2008 Senior, Problem 1.
Translated by ChatGPT 5