Skip to content

Instantly share code, notes, and snippets.

@adw0rd
Last active April 3, 2019 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adw0rd/d512ce1e684d52b9b9f33943c60ea0e0 to your computer and use it in GitHub Desktop.
Save adw0rd/d512ce1e684d52b9b9f33943c60ea0e0 to your computer and use it in GitHub Desktop.
import sys
def main(text):
n, s, result = '', '', []
for i in text:
if i.isdigit():
n += i
else:
if n:
result.append(s * int(n))
s = i
n = ''
result.append(s * int(n))
return ''.join(result)
if __name__ == '__main__':
print(main(sys.argv[1]))
@adw0rd
Copy link
Author

adw0rd commented Apr 3, 2019

python repeater.py a1b2c3d4e5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment