Login
|
Signup
langref.org
-
ruby
add..
all
clojure
cpp
csharp
erlang
fantom
fsharp
go
groovy
haskell
java
ocaml
perl
php
python
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Strings
Manipulation
Reverse the words in a string
Given the string
"This is a end, my only friend!"
, produce the string
"friend! only my end, the is This"
ruby
reversed = text.split.reverse.join(' ')
text = "This is the end, my only friend!"
reversed = text.split.reverse.join(' ')
puts reversed
Submit a new solution for
ruby
There are 26 other solutions in
additional
languages (
clojure
,
cpp
,
csharp
,
erlang
...)