#include #include using namespace std; string Palyndrom( n) { for (int i = n.length(); i >= 0; --i) { x = x + n[i]; } n = x + n; return n; } int main() { int t,y=0; string n,x; cin >> t; for (int i = 0; i < t; i++) { cin >> n; while (n.front() != n.back()) { n = Palyndrom(n); y++; } cout << n << " " << y << endl; } system("pause"); return 0; }