fork download
  1. # Xoa khoang trang dau, cuoi, giua
  2. def ToiUuChuoi(s):
  3. s2=s
  4. s2=s.strip()
  5. arr=s2.split(' ')
  6. s2=""
  7. for x in arr:
  8. word=x
  9. if len(word.strip())!=0:
  10. s2=s2+word+" "
  11. return s2.strip()
  12.  
  13. s=input("String:")
  14. s=ToiUuChuoi(s)
  15. print(s)
Runtime error #stdin #stdout #stderr 0.04s 9392KB
stdin
Standard input is empty
stdout
String:
stderr
Traceback (most recent call last):
  File "./prog.py", line 13, in <module>
    s=input("String:")
EOFError: EOF when reading a line