http://www.elijahqi.win/archives/4041
We say that a string is oddodd if and only if all palindromic substrings of the string have odd length.
Given a string ss, determine if it is oddodd or not.
A substring of a string ss is a nonempty sequence of consecutive characters from ss. A palindromic substring is a substring that reads the same forwards and backwards.
1 Input
The input consists of a single line containing the string ss (1 ≤ |s| ≤ 100)(1≤∣s∣≤100).
It is guaranteed that ss consists of lowercase ASCIIASCII letters (‘a’–‘z’)(‘a’–‘z’) only.
2 Output
If ss is oddodd, then print “Odd.Odd.” on a single line (without quotation marks). Otherwise, print “Or\ not.Or not.” on a single line (without quotation marks).
样例输入复制
1
2
3
4
amanaplanacanalpanama
madamimadam
annamyfriend
nopalindromes
样例输出复制
1
2
3
4
Odd.
Odd.
Or not.
Odd.
用manacher找出所有回文串的长度,判断下是否是奇数即可
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<bits/stdc++.h>
using namespace std;
char s[110],a[2200];
int p[220];