I was trying to understand falsetru's solution, and essentially using iter simplifies what the following would be doing:
def is_subseq(sub, string):
i = 0
for c in string:
if i == len(sub):
break
if sub[i] == c:
i += 1
if i != len(sub):
return False
return True
def is_subseq2(sub, string):
j = 0
count = 0
for c in sub:
if j == len(string):
return False
while j < len(string) and string[j] != c:
j += 1
if string[j] == c:
count += 1
return count == len(sub)