mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
1b4d6396e4
2700-2799
45 lines
698 B
C++
45 lines
698 B
C++
#include<stdio.h>
|
|
#include<string.h>
|
|
int main()
|
|
{
|
|
int i,j,len,k,z,l,flag;
|
|
char ch[100];
|
|
char s[100][2];
|
|
while(gets(ch))
|
|
{
|
|
memset(s,0,sizeof(s));
|
|
flag=0;
|
|
if(ch[0]=='*')
|
|
break;
|
|
len=strlen(ch);
|
|
for(i=1;i<len-1;i++)
|
|
{
|
|
k=0;
|
|
for(j=0;j+i<len;j++)
|
|
{
|
|
s[k][0]=ch[j];
|
|
s[k][1]=ch[j+i];
|
|
k++;
|
|
}
|
|
for(z=0;z<k;z++)
|
|
for(l=z+1;l<k;l++)
|
|
{
|
|
if(s[z][0]==s[l][0]&&s[z][1]==s[l][1])
|
|
{flag=1;break;}
|
|
}
|
|
if(flag==1)
|
|
break;
|
|
}
|
|
if(flag==1)
|
|
{
|
|
printf("%s is NOT surprising.\n",ch);
|
|
}
|
|
else
|
|
{
|
|
printf("%s is surprising.\n",ch);
|
|
}
|
|
memset(ch,0,sizeof(ch));
|
|
}
|
|
return 0;
|
|
}
|