1 class Solution:
2     def findOcurrences(self, text: str, first: str, second: str) -> 'List[str]':
3         ary = text.split(' ')
4         n = len(ary)
5         result = list()
6         for i in range(n):
7             if ary[i] == first and i+1<n-1 and ary[i+1] == second:
8                 result.append(ary[i+2])
9         return result

 

posted on 2019-06-09 20:13  Sempron2800+  阅读(231)  评论(0编辑  收藏  举报