importfileinputimportreforlineinfileinput.input():## Make sure the string is in UTF-8, and remove any newlines#line=line.decode("utf-8").strip()## Should look like an unsigned number (possible decimal)# and be a palindrome.#if(re.match(r'^\d+(\.\d+)?$',line,re.UNICODE)andline==line[::-1]):print1else:print0