main(){char*c,s[99];for(;~scanf("%s",&s);printf("%i\n",*s==0))for(c=s;*c;)*c==(c[1]^32)?memcpy(c,c+2,99),c=s:c++;}