Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
one liner solution in Creative category for Long Pressed by Sim0000
from itertools import groupby as g, zip_longest as z
def long_pressed(s, t) -> bool:
return s!=t and all(c==d and len(list(m))<=len(list(n))for(c,m),(d,n)in z(g(s),g(t),fillvalue=(0,0)))
print("Example:")
print(long_pressed("alex", "aaleex"))
assert long_pressed("alex", "aaleex") == True
assert long_pressed("welcome to checkio", "weeeelcome to cccheckio") == True
assert long_pressed("there is an error here", "there is an errorrr hereaa") == False
assert long_pressed("hi, my name is...", "hi, my name is...") == False
print("The mission is done! Click 'Check Solution' to earn rewards!")
Sept. 22, 2022
Comments: