好久没写了
#include <IOSTREAM>
#include <STRING>
#include <SET>
using namespace std;
bool IsSurprisingWord(const string Str)
{
if (Str.length()<=2) return true;
int D=Str.length()-2;
int i,j;
string A,B,C;
set<string> ST;
for (int ic=1;ic<=D;ic++)
{
i=0,j=i+ic;
ST.clear();
while (i+ic<=Str.length())
{
A=Str[i];B=Str[j];
C=A+B;
if (ST.find(C)!=ST.end()) return false;
ST.insert(C);
i++;j=i+ic;
}
}
return true;
}
int main()
{
string S;
while (cin>>S)
{
if(S=="*") break;
if (IsSurprisingWord(S))
cout<<S<<" is surprising."<<endl;
else
cout<<S<<" is NOT surprising."<<endl;
}
return 0;
}