S=gets.chop I=(0..L=S.size/2).find{S[_1]!=S[~_1]}||L puts [S[0,I]+S[~I]+S[I..],S[..~I]+S[I]+S[-I,L*I]].find{_1==_1.reverse}||:NA