Rotated Palindromes

AtCoder - arc064_d