#include<iostream>
#include<string.h>
using namespace std;
char s[300];
int n;
bool e_palindrom(char[100]);
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
      cin>>s;
      if(e_palindrom(s)) cout<<1;
      else cout<<0;
    }
    return 0;
}
bool e_palindrom(char[100])
{
    int este=true;
    for(int jos=0,sus=strlen(s)-1;jos<strlen(s)/2&&este;jos++,sus--) este=s[jos]==s[sus];
  return este;
}