判重这种事。。。
题意比较难懂。。这个距离是指两个字符在字符串中的位置之差减去1.
#include <stdio.h>
#include <iostream>
#include <queue>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <fstream>
#include <set>
#include <stack>
using namespace std;
#define READ freopen("acm.in","r",stdin)
#define WRITE freopen("acm.out","w",stdout)
#define ll long long
#define ull unsigned long long
#define PII pair<int,int>
#define PDI pair<double,int>
#define PDD pair<double,double>
#define MII map<int,int>::iterator
#define fst first
#define sec second
#define MS(x,d) memset(x,d,sizeof(x))
#define INF 0x3f3f3f3f
#define ALL(x) x.begin(),x.end()
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define ROOT 0,n-1,1
#define PB push_back
#define FOR(a,b,c) for(int a=b;a<c;a++)
#define MOD 1000000007
#define keyTree (ch[ ch[root][1] ][0])
#define MAX 1111111
char s[100];
bool judge()
{
int len=strlen(s);
for(int i=2;i<=len-1;i++)
{
set<string> S;
int cnt=0;
for(int j=0;j+i-1<len;j++)
{
string ts="";
ts+=s[j],ts+=s[j+i-1];
S.insert(ts);
cnt++;
}
if(S.size()!=cnt)
return false;
}
return true;
}
int main()
{
READ;
while(scanf("%s",s)&&s[0]!='*')
{
if(!strlen(s))
continue;
if(judge())
printf("%s is surprising.\n",s);
else
printf("%s is NOT surprising.\n",s);
}
return 0;
}