P28159 [洛谷] [NOIP2008 Senior Group] Foolish Monkey
普及
题目描述

Problem Description

Foolish Monkey has a very limited vocabulary, so he always finds it头疼 when doing multiple-choice English questions. However, he has discovered a method that, according to his experiments, greatly increases the likelihood of choosing the correct option!

The method is described as follows: Suppose $\text{maxn}$ is the frequency of the most frequent letter in the word, and $\text{minn}$ is the frequency of the least frequent letter in the word. If $\text{maxn} - \text{minn}$ is a prime number, then Foolish Monkey considers this a "Lucky Word," and such a word is likely to be the correct answer.

Input Format

A single word, consisting only of lowercase letters, with a 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$.

Sample Input and Output

Sample Input #1

error

Sample Output #1

Lucky Word
2

Sample Input #2

olympic

Sample Output #2

No Answer
0

Notes

Explanation of Sample Input and 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 of Sample Input and Output #2

In the word olympic, the most frequent letter $\texttt i$ appears $1$ time, and the least frequent letter also appears $1$ time. $1 - 1 = 0$, and $0$ is not a prime number.

(The original problem statement error has been corrected)

NOIP2008 Senior Group, Problem 1

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
error
样例输出
Lucky Word 2