f = lambda s:s[~len(s)/2:]in'987654321'>s==s[::-1] for n in xrange(10000000): if f(str(n)): print n
Standard input is empty
1 2 3 4 5 6 7 8 9 121 232 343 454 565 676 787 898 12321 23432 34543 45654 56765 67876 78987 1234321 2345432 3456543 4567654 5678765 6789876