Created
September 9, 2023 06:48
-
-
Save codeperfectplus/ac74e5ace008b5e9ddb8a8706ea66b50 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
| # Enter your code here. Read input from STDIN. Print output to STDOUT | |
| import itertools | |
| def compress_the_string(string): | |
| res = itertools.groupby(string) | |
| for k, g in res: | |
| print((len(list(g)), int(k)), end=' ') | |
| if __name__ == '__main__': | |
| string = input() | |
| compress_the_string(string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment