Ruby Question: You are given a string containing uppercase, lowercase mixed char
ID: 3837358 • Letter: R
Question
Ruby Question:
You are given a string containing uppercase, lowercase mixed characters in words and words separated with one of the special characters like '*', '%', '@', '#', '&', '!', '$'.
"EVeRy*Day%yOu@ARe%pLanTIng#A#sEeD$Of%cUrIOsiTY&AnD#mOtiVAtIoN#To@KnOW*aNd&tO!GROw%aND#sUCcEeD"
If you look at each word within the junk looking string above, it contains a meaningful statement like this:
' Every day you are planting a seed of curiosity and motivation to know and to grow and succeed'
Write a ruby script to make the above string (in dark red) , using the given (junk looking) string and the set of special characters.
Explanation / Answer
Hi,
Please use below code and see if it works. I have not tested it due to a software issue on my machine-
"EVeRy*Day%yOu@ARe%pLanTIng#A#sEeD$Of%cUrIOsiTY&AnD#mOtiVAtIoN#To@KnOW*aNd&tO!GROw%aND#sUCcEeD".gsub("*"," ").gsub("%"," ").gsub("@"," ").gsub("#"," ").gsub("&"," ").gsub("&"," ").gsub("!"," ").gsub("$"," ")
Regards,
Vinay Singh
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.