#include #include char s[200100]; char addC; int addPos; int saiki( int st, int gt, int rewrite ){ int ret; if( st >= gt ){ return 1; } for(;s[st] == '\0';st++); for(;s[gt] == '\0';gt--); if( s[st] != s[gt]){ if(rewrite != 0){ return 0; } rewrite = 1; addC = s[st]; addPos = gt+1; ret = saiki(st+1, gt, rewrite); if(ret == 0){ addC = s[gt]; addPos = st-1; ret = saiki(st, gt-1, rewrite); } }else{ ret = saiki(st+1, gt-1, rewrite); } return ret; } int searchReverse( int st, int gt ){ while(st < gt ){ for(;s[st] == '\0';st++); for(;s[gt] == '\0';gt--); if( s[st] != s[gt]){ return 0; } st+=1; gt-=1; } return st; } int main(void){ char tmp[100100]; int i, st=0, gt; int ret; fgets(tmp, sizeof(tmp), stdin); tmp[strlen(tmp)-1] = '\0'; for(i=0;tmp[i] != '\0';i++){ s[(i*2)+1] = tmp[i]; gt = (i*2)+2; } ret = searchReverse(st,gt); if(ret != 0){ addC = 'a'; addPos = ret; ret = 1; }else{ ret = saiki(st, gt, 0); } if(ret == 1){ s[addPos] = addC; for(i=0;i