s = " hello world "
print(s.strip())
# Output: "hello world"
s = " hello world "
print(s.replace(" ", ""))
# Output: "helloworld"
s = " hello world "
print("".join(s.split()))
# Output: "helloworld"
import re
s = " hello world "
print(re.sub(r"\s+", "", s))
# Output: "helloworld"