/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
static int result;
public static int recursion
(String s,
int l,
int r
){ result++;
if(l >= r) return 1;
else if(s.charAt(l) != s.charAt(r)) return 0;
else return recursion(s, l+1, r-1);
}
public static int isPalindrome
(String s
){ return recursion(s, 0, s.length()-1);
}
{
// your code goes here
Scanner sc
= new Scanner
(System.
in); int T = sc.nextInt();
for(int i = 0; i < T; i++) {
result = 0;
System.
out.
println(isPalindrome
(sc.
next()) + " " + result
); }
sc.close();
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXN0YXRpYyBpbnQgcmVzdWx0OwogICAgcHVibGljIHN0YXRpYyBpbnQgcmVjdXJzaW9uKFN0cmluZyBzLCBpbnQgbCwgaW50IHIpewogICAgCXJlc3VsdCsrOwogICAgICAgIGlmKGwgPj0gcikgcmV0dXJuIDE7CiAgICAgICAgZWxzZSBpZihzLmNoYXJBdChsKSAhPSBzLmNoYXJBdChyKSkgcmV0dXJuIDA7CiAgICAgICAgZWxzZSByZXR1cm4gcmVjdXJzaW9uKHMsIGwrMSwgci0xKTsKICAgIH0KICAgIAogICAgcHVibGljIHN0YXRpYyBpbnQgaXNQYWxpbmRyb21lKFN0cmluZyBzKXsKICAgICAgICByZXR1cm4gcmVjdXJzaW9uKHMsIDAsIHMubGVuZ3RoKCktMSk7CiAgICB9CiAgICAKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF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