I'm using ruby and I'm trying to reduce a long white spaces to a single character. This is the code I'm trying:
str = hello world how are you
puts str.gsub(/\s/, '#')
Output of my current code:
hello#world####how#####are##you
Desired output:
hello#world#how#are#you
Any idea how to reach my desired output?