Manacher算法:
参考资料:https://segmentfault.com/a/1190000003914228
http://www.cnblogs.com/biyeymyhjob/archive/2012/10/04/2711527.html
代码:
#include <iostream> #include <stdio.h> #include <cstring> #include <algorithm> using namespace std; const int maxn = 100000+10; char s[maxn]; char A[maxn*2]; int B[maxn*2]; int Manacher(char s[], int len) { int maxlen = 0; int l = 0; A[l++] = '$'; A[l++] = '#'; for (int i = 0; i < len; i++) { A[l++] = s[i]; A[l++] = '#'; } A[l] = '