Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = []
- r = []
- f = ""
- e = []
- s = raw_input('Sentence: ')
- ss = s.lower().split()
- lss = len(ss)
- c = 0
- while c != lss:
- if ss[c] == 'chin' or ss[c] == 'chi':
- a.extend([1])
- else:
- a.extend([0])
- c += 1
- r = a
- c = 0
- l = 0
- while c != lss:
- if a[c] == 0:
- l += 1
- r[c] = l
- c += 1
- elif a[c] == 1:
- r[c] = l
- if c != 0:
- r[c - 1] = l
- if c != lss - 1:
- r[c + 1] = l
- c += 2
- for l in range(1, 6):
- for c in range(0, lss):
- if r[c] == l:
- f += ss[c] + " "
- if f.strip() != "":
- e.extend([f.strip()])
- f = ""
- print e
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement