Skip to content

Instantly share code, notes, and snippets.

@erdem
Created November 29, 2015 23:34
Show Gist options
  • Save erdem/3498410fadd27b561622 to your computer and use it in GitHub Desktop.
Save erdem/3498410fadd27b561622 to your computer and use it in GitHub Desktop.
Codingame ASCII Art Puzzle
l = int(raw_input())
h = int(raw_input())
t = raw_input()
result = []
characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ?"
for i in xrange(h):
row = raw_input()
threshold = len(row)/len(characters)
chr_width = threshold
for c in t:
c = c.upper()
if c in characters:
chr_index = characters.index(c)
else:
chr_index = len(characters) - 1
chr_start = chr_index * chr_width
chr_end = (chr_index + 1) * chr_width
result.append(row[chr_start:chr_end])
result.append("\n")
print "".join(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment