You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
802 B
39 lines
802 B
#include<iostream>
|
|
#include<map>
|
|
#include<math.h>
|
|
#include<algorithm>
|
|
#include<string.h>
|
|
using namespace std;
|
|
map<char,int>m;
|
|
int main(){
|
|
int maxx=-999999,minn=999999;
|
|
char a[101];
|
|
cin>>a;
|
|
int l=strlen(a);
|
|
for(int i=0;i<l;i++){
|
|
m[a[i]]++;
|
|
maxx=max(maxx,m[a[i]]);
|
|
//minn=min(minn,m[a[i]]);
|
|
}
|
|
for(int i=0;i<l;i++){
|
|
minn=min(minn,m[a[i]]);
|
|
}
|
|
//cout<<maxx<<' '<<minn<<endl;
|
|
maxx-=minn;
|
|
// cout<<maxx<<endl;
|
|
if(maxx==0||maxx==1){
|
|
cout<<"No Answer"<<endl;
|
|
cout<<0;
|
|
return 0;
|
|
}
|
|
for(int i=2;i<=sqrt(maxx);i++){
|
|
if(maxx%i==0){
|
|
cout<<"No Answer"<<endl;
|
|
cout<<0;
|
|
return 0;
|
|
}
|
|
}
|
|
cout<<"Lucky Word"<<endl;
|
|
cout<<maxx;
|
|
return 0;
|
|
} |