fork download
  1. import re
  2. s = "This is my first poem\nthat does not make sense\nhow far should it go\nnobody can know.\n\nHere is a seconds\nthat is not as long\ngoodbye\n\n"
  3. res = re.sub(r"(?<!\n)\n(?!\n)", " ", s)
  4. print(res)
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
This is my first poem that does not make sense how far should it go nobody can know.

Here is a seconds that is not as long goodbye