Remove redundant spaces
Add foldl and reverse