class Solution {
public:
string shortestPalindrome(string s) {
string t(s.rbegin(),s.rend());
int n=s.size();
s=' '+s+'#'+t;
vector nex(n*2+2);
for(int i=2,j=0;i 
class Solution {
public:
string shortestPalindrome(string s) {
string t(s.rbegin(),s.rend());
int n=s.size();
s=' '+s+'#'+t;
vector nex(n*2+2);
for(int i=2,j=0;i