fork(3) download
  1. # your code goes here
  2. import re
  3. i=input()
  4. s=i.find('AUG')
  5. t=min(x for x in sorted(map(i.find,re.findall('UA[AG]|UGA',i)))if x>=s)
  6. if s>=0:print re.findall('...',i[s:t])
  7. else:print []
Success #stdin #stdout 0.01s 9016KB
stdin
"AUGUGGGAAUGA"
stdout
['AUG', 'UGG', 'GAA']