1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #include<cstring> 5 #include<cmath> 6 #include<vector> 7 #include<queue> 8 #include<stack> 9 #include<cstdlib> 10 #include<bitset> 11 #include<iomanip> 12 using namespace std; 13 int cnt,minn=1000,maxn,k; 14 int su[105],ttt6[30]; 15 bool vis[105]; 16 char word1[105]; 17 int main (){ 18 freopen ("word.in","r",stdin); 19 //freopen ("word.out","w",stdout); 20 scanf ("%s",word1);//here 21 for (int i=0;i<strlen(word1);i++) 22 ttt6[word1[i]-96]++; 23 for (int i=1;i<=26;i++) 24 if (ttt6[i]!=0) 25 { 26 maxn=max(maxn,ttt6[i]); 27 minn=min(minn,ttt6[i]); 28 } 29 k=maxn-minn; 30 if (k==0||k==1) 31 { 32 printf ("No Answer\n0"); 33 return 0; 34 } 35 for (int i=2;i<=sqrt(k);i++) 36 if (k%i==0) 37 { 38 printf ("No Answer\n0"); 39 return 0; 40 } 41 printf ("Lucky Word\n%d",k); 42 return 0; 43 }
时间: 2024-10-14 22:30:42