fork download
  1. #!/usr/bin/env python
  2. import fileinput, re, sys
  3. from itertools import ifilter
  4.  
  5. re_not_foo = re.compile(r"^(f(o[^o]|[^o])|[^f])*$")
  6. for line in ifilter(re_not_foo.match, fileinput.input()):
  7. sys.stdout.write(line)
  8.  
Success #stdin #stdout 0.03s 6724KB
stdin
f, fo or barf
f
fo
barf
foo
'foo'
abdfoode
abdfode
abdfde
abcde
f

 
fo
foo
fooo
ofooa
ofo
ofoo
stdout
f, fo or barf
f
fo
barf
abdfode
abdfde
abcde
f

 
fo
ofo