aboutsummaryrefslogtreecommitdiff
path: root/challenge-095/abigail/python/ch-1.py
blob: baadd38de415ff3f10c450554ce15dae68cf9bd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import fileinput
import re

for line in fileinput . 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) and
        line == line [::-1]):
        print 1
    else:
        print 0