Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def solve(self, s, words):
- # Write your code here
- length = len(s)
- returned = []
- for i in range(len(words)):
- inWord = 0
- try:
- for j in range(length):
- if words[i][j] == s[j]:
- inWord += 1
- except IndexError:
- continue
- if inWord == length:
- returned.append(words[i])
- new = returned.sort()
- return sorted(returned)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement