Skip to content

Instantly share code, notes, and snippets.

@sadhasivam
Created July 29, 2016 21:33
Show Gist options
  • Save sadhasivam/1d8b8187ea675703d07c9401b785ed18 to your computer and use it in GitHub Desktop.
Save sadhasivam/1d8b8187ea675703d07c9401b785ed18 to your computer and use it in GitHub Desktop.
RLE String
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