Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Naive solution in Clear category for The Hidden Word by obone
def checkio(text, word):
htext = text.replace(' ', '').lower().split('\n')
htext = [t.ljust(len(max(htext, key=len))) for t in htext]
for n in range(len(htext)):
pos = htext[n].find(word)
if pos > -1:
return [n + 1, pos + 1, n + 1, pos + len(word)]
vtext = [''.join(d) for d in zip(*htext)]
for n in range(len(vtext)):
pos = vtext[n].find(word)
if pos > -1:
return [pos + 1, n + 1, pos + len(word), n + 1]
return []
July 13, 2019
Comments: