Created
February 17, 2017 11:30
-
-
Save arcolife/90a33f8c01ea87355ed12f6e635a9262 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/env python3 | |
| # aaabbcd -> abcd | |
| # https://groups.google.com/forum/#!forum/dsa_sg | |
| x = list('aaabbcd') | |
| tmp = '' | |
| for i in range(0,len(x),2): | |
| # import pdb; pdb.set_trace() | |
| if i+1 < len(x): | |
| if x[i]==x[i+1]: | |
| if x[i] not in tmp: | |
| tmp+=x[i] | |
| else: | |
| if x[i] not in tmp: | |
| tmp+=x[i] | |
| if x[i+1] not in tmp: | |
| tmp+=x[i+1] | |
| else: | |
| if x[i] not in tmp: | |
| tmp+=x[i] | |
| print(tmp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.