很简单的题了吧……
/*
* Author: stormdpzh
* POJ: 3096 Surprising Strings
* Time: 2012/5/7 21:28:34
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <functional>
#define sz(v) ((int)(v).size())
#define rep(i, n) for(int i = 0; i < n; i++)
#define repf(i, a, b) for(int i = a; i <= b; i++)
#define out(n) printf("%d\n", n)
#define wh(n) while(scanf("%d", &n) != EOF)
#define whz(n) while(scanf("%d", &n) != EOF && n != 0)
#define lint long long
using namespace std;
set<string> st;
string str;
int main()
{
//freopen("data.in", "r", stdin);
while(cin >> str && str != "*") {
bool flag = true;
int len = str.size();
for(int i = 0; i < len - 1; i++) {
st.clear();
for(int j = 0; j < len - i - 1; j++) {
string tmp = "";
tmp += str[j];
tmp += str[j + 1 + i];
if(st.find(tmp) == st.end()) {
st.insert(tmp);
}
else {
flag = false;
break;
}
}
if(!flag) break;
}
if(flag)
cout << str << " is surprising." << endl;
else
cout << str << " is NOT surprising." << endl;
}
return 0;
}