Created
July 29, 2016 21:33
-
-
Save sadhasivam/1d8b8187ea675703d07c9401b785ed18 to your computer and use it in GitHub Desktop.
RLE String
This file contains 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
input = "DJJGKHG HBMBEBIBFBF HBMBQDK HBMBTDH HBMBEBIBFBF HBNGKHG" | |
line_id = input.split(" ") | |
image_string = "" | |
for row in line_id: | |
index = 0 | |
for c in row: | |
rle = ord(c) - 64 | |
if index%2 == 0: | |
image_string += "0" * rle | |
else: | |
image_string += "!" * rle | |
index += 1 | |
image_string += "\n" | |
print image_string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment