#include <iostream>
#include <cstring>
using namespace std;
ifstream f("palindrom.in");
ofstream cout("palindrom.out");
int main() {
int n;
f >> n;
for (int i = 0; i < n; i++) {
char s[101];
f >> s;
int m = 0;
while (s[m] != '\0')
m++;
m--;
int j = 0;
bool sem = true;
while (s[j] != '\0') {
if (s[j] != s[m - j])
sem = false;
j++;
}
if (sem)
cout << 1 << endl;
else
cout << 0 << endl;
}
return 0;
}