Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Clear category for The Hidden Word by gyahun_dash
from itertools import zip_longest
def checkio(text, word):
def find(lines, trans=False):
if trans: lines = map(''.join, zip_longest(*lines, fillvalue=' '))
results = ((row, s.find(word) + 1) for row, s in enumerate(lines, 1))
row, col = next(((row, col) for row, col in results if col), (0, 0))
end = col + len(word) - 1
if col: return [col, row, end, row] if trans else [row, col, row, end]
lines = text.lower().replace(' ', '').split()
return find(lines) or find(lines, trans=True)
Oct. 19, 2014
Comments: