判断一个字符串是否是surprising
set 瞎搞就好了
ACcode:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <cstring>
using namespace std;
#define inf 0x3f3f3f3f
#define maxn 105
#define ll long long
char s[maxn];
int main(){
while(scanf("%s",s)&&s[0]!='*'){
int len=strlen(s);
int flag=0;
for(int l=1;l<len&&!flag;++l){
set<string>q;
string tmp;
for(int i=0;i+l<len&&!flag;++i){
tmp="";
tmp+=s[i];
tmp+=s[i+l];
if(q.find(tmp)!=q.end())flag=1;
else q.insert(tmp);
}
}
printf("%s %s surprising.\n",s,flag?"is NOT":"is");
}
return 0;
}