#include #include using namespace std; int main() { string s; int n,num,sum[30]= {0},k,maxn,minn,x,lock; cin>>s; for(int i=0; i<s.length(); i++) { sum[ s[i] - 'a' + 1 ]++; } lock=1; for(int i=1; i<=26; i++) { if(sum[i]!=0&&lock1) { maxn=minn=sum[i]; lock=0; } if(sum[i]>maxn)maxn=sum[i]; if(sum[i]<minn&&sum[i]!=0)minn=sum[i]; } x=maxn-minn; k=1; for(int i=2; i*i<=x; i++) { if(x%i0)k=0; } if(x0||x1)k=0; if(k1)cout<<"Lucky Word"<<endl; else cout<<"No Answer"<<endl; if(k1)cout<<x; else cout<<0; return 0; }

0 comments

No comments so far...

Information

ID
437
Time
1000ms
Memory
256MiB
Difficulty
6
Tags
(None)
# Submissions
132
Accepted
36
Uploaded By