**才看
2023-09-07 12:34:12
发布于:广东
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define str string
#define output cout
inline int input()
{
int x=0,f=1;
char ch=getchar();
while(!isdigit(ch))
{
if(ch=='-')
{
f=-1;
}
ch=getchar();
}
while(isdigit(ch))
{
x=(x<<1)+(x<<3)+(ch^48);
ch=getchar();
}
return xf;
}
str strn;
int len,flag,maxn,minn=2e6+5;
int arr[1000010]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
int cnt[1000010];
signed main()
{
getline(cin,strn);
len=strn.size();
for(int i=0;i<=len-1;i++)
{
cnt[strn[i]-'a'];
maxn=max(maxn,cnt[strn[i]-'a']);
}
for(int i=0;i<=len-1;i)
{
if(cnt[i]!=0)
{
if(cnt[i]<minn)
{
minn=cnt[i];
}
}
}
maxn-=minn;
if(maxn0 or maxn1)
{
cout<<"No Answer\n0";
return 0;
}
for(int i=2;ii<=maxn;i++)
{
if(maxn%i==0)
{
cout<<"No Answer\n0";
return 0;
}
}
cout<<"Lucky Word\n";
cout<<maxn;
return 0;
}
这里空空如也
有帮助,赞一个