显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstring>
#define syy myson
using namespace std;
char a[101];
int word[27],len=0,maxn=0,minn=101,ans,i;
int is_prime(int a)
{
if(a==0)return 0;
for(int j=2;j*j<=a;j++)
if(a%j==0)return 0;
return a!=1;
}
int Main()
{
freopen("word.in","r",stdin);freopen("word.out","w",stdout);
ios::sync_with_stdio(false);
cin>>a;
for(i=0;i<strlen(a);i++)
word[int(a[i])-96]++;
for(i=1;i<=26;i++)
{
if(word[i]==0)continue;
if(word[i]<minn)minn=word[i];
if(word[i]>maxn)maxn=word[i];
}
ans=maxn-minn;
if(is_prime(ans))
printf("Lucky Word\n%d",ans);
else
printf("No Answer\n0");
return 0;
}
int main(){;};
int syy=Main();