#include <iostream>#include <stdio.h>#include <string.h>using namespace std;int main(){char s[80];while(scanf("%s",s)){if(strcmp(s,"*")==0)return 0;else{int flag;for(int d = 1 ; d < strlen(s)-1; d++){char **a = new char*[strlen(s)-d];for(int i = 0 ; i < strlen(s)-d; i++){a[i] = new char[2];a[i][0] = s[i];a[i][1] = s[i+d];}flag = 0;for( int j = 0 ; j < strlen(s)-d; j++){for(int k = j+1; k < strlen(s)-d; k++){if(strcmp(a[j],a[k])==0){flag = 1;break;}}if(flag == 1)break;}if(flag == 1)break;}if(flag == 1)cout<<s<<" is NOT surprising."<<endl;elsecout<<s<<" is surprising."<<endl;}}return 0;}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)