SDUT 2019 Autumn Team Contest 20th A
题意:一个串的回文子串如果是奇数长度则称为Odd.
解体关键:如果一个串的回文子串为偶数长度,则其必有两个相邻的字母相同。考的不是知识点,是IQ
代码如下:
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
while(cin>>s)
{
int len;
len=s.size();
int f=1;
for(int i=0; i<len-1; i++)
{
if(s[i]==s[i+1])
{
cout<<"Or not."<<endl;
f=0;
break;
}
}
if(f)
{
cout<<"Odd."<<endl;
}
}
return 0;
}