Skip to content

Instantly share code, notes, and snippets.

@vivek-vijayan
Last active April 25, 2025 08:39
Show Gist options
  • Save vivek-vijayan/e4693c8254d1ccb77cb21753c1e01d21 to your computer and use it in GitHub Desktop.
Save vivek-vijayan/e4693c8254d1ccb77cb21753c1e01d21 to your computer and use it in GitHub Desktop.
Quicker way of finding the Sub sequence values
a = "abcdefg"
l = ["a", "acef", "defg", "gg"]
word_count = 0
for word in l:
i = 0 # pointer in main string
for ch in word:
i = a.find(ch, i)
if i == -1:
break
i += 1
else:
word_count += 1
print(word_count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment