RB
rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
=begin
Remove Spaces from a String
Given a string as input, output it without spaces.
For example:
string = "ab c d e fgh i j kl mn opqr stuvwxyz"
result = "abcdefghijklmnopqrstuvwxyz"
=end
puts gets.to_s.gsub!(/\s+/, '')
#the ! removes the spaces from the variable instead of creating a new one without spaces
#could've use .gsub(" ","") too
#.remove(" ")
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run