fork download
  1. def touchingdigits(a):
  2. s = str(a)
  3. for i in range(1, len(s)):
  4. if s[i] == s[i-1]:
  5. return True
  6. return False
  7.  
  8. ct = 0
  9. for i in range(0, 1000000):
  10. if touchingdigits(i):
  11. ct += 1
  12.  
  13. print(ct)
Success #stdin #stdout 2.26s 7796KB
stdin
Standard input is empty
stdout
402129