5 solutions
-
0
#include<bits/stdc++.h> using namespace std; int cnt[300]; int main() { string s; cin>>s; int minv=110,maxv=0; for(char c:s) { cnt[c]++; } for(char c:s) { minv=min(minv,cnt[c]); maxv=max(maxv,cnt[c]); } int t=maxv-minv; bool st=1; if(t<2) st=0; for(int i=2;i<t;i++) { if(t%i==0) { st=0; } } if(st) { cout<<"Lucky Word"<<endl<<t; } else { cout<<"No Answer"<<endl<<0; } return 0; }
Information
- ID
- 928
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- (None)
- # Submissions
- 130
- Accepted
- 29
- Uploaded By