Question: I am trying to remove spaces.
I have tried everything from previous threads including `re.sub`

Code: 

```
wordinput = (input("Input:\n"))
wordinput = wordinput.lower()
cleanword = wordinput.replace(" ","")
cleanword = wordinput.replace(",","")
cleanword = wordinput.replace(".","")
revword = cleanword [::-1]
print(cleanword)
print(revword)
print("Output:")
if (cleanword == revword):
    print('"The word ' + wordinput + ' is a palindrome!"')
else:
    print('"Unfortunately the word ' + wordinput + ' is not a palindrome. :(')

```

Output:

```
Input:
mr owl ate my metal worm 
mr owl ate my metal worm
mrow latem ym eta lwo rm
Output:
"Unfortunately the word mr owl ate my metal worm is not a palindrome. :(

```

Answer: 
[@StephenRauch explains](https://stackoverflow.com/a/49102129/9209546) your problem well.

But here is a better way to implement your logic:

```
chars = ',. '
wordinput = 'mr owl ate my metal worm '
cleanword = wordinput.translate(dict.fromkeys(map(ord, chars)))

# 'mrowlatemymetalworm'

```
Maybe you should try this one: 

```
wordinput = raw_input("Input:\n")

cleanword =''.join([x for x in wordinput.lower() if x not in (',','.',' ')])

if cleanword[:] == cleanword[::-1]:

    print ('"The word ' + wordinput + ' is a palindrome!"')

else:
    print ('"The word ' + wordinput + ' is not a palindrome!"')

```