Skip to content

Instantly share code, notes, and snippets.

@ololobus
Last active August 30, 2016 14:45
Show Gist options
  • Save ololobus/ff8ec73e9704ae424e1db5fd22809fb3 to your computer and use it in GitHub Desktop.
Save ololobus/ff8ec73e9704ae424e1db5fd22809fb3 to your computer and use it in GitHub Desktop.
import re
pattern = re.compile('(\d*)(00|11|22|33|44|55|66|77|88|99)(\d*)')
n = 0
for i in range(1, 10000):
s = str(i)
if pattern.match(s):
n += 1
print 9999 - n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment