Challenge 13: Yet another String Reversal. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Challenge 13: Yet another String Reversal.

Write a program to input a string consisting of more than one word. Reverse the words without changing their order. Example: Sample Input: Amrit Mahendra Joseph Sample Output: tirmA ardnehaM hpesoJ A word is any set of characters separated by a space or any non alphanumeric character. Best of Luck!

5th Sep 2017, 7:57 AM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar
22 Answers
5th Sep 2017, 8:49 AM
Vari93
Vari93 - avatar
5th Sep 2017, 9:25 AM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar
5th Sep 2017, 8:14 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
https://code.sololearn.com/c8JJGKpfmEbg/?ref=app
5th Sep 2017, 8:36 AM
Ekansh
5th Sep 2017, 9:16 AM
David Ashton
David Ashton - avatar
5th Sep 2017, 9:37 AM
Calviղ
Calviղ - avatar
+ 3
@Vengat, maybe it is.. Let's make it hard.. Check it now...
5th Sep 2017, 8:14 AM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar
+ 3
Code updated. Now works
5th Sep 2017, 8:21 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
5th Sep 2017, 8:29 AM
Calviղ
Calviղ - avatar
+ 3
@Vari93 Don't Spam here, compress your replies into one post ! And there is no objections on reversing Symbols according to challenge.
5th Sep 2017, 8:58 AM
Ekansh
+ 3
I think @Vari93 is on the right track.
5th Sep 2017, 9:45 AM
David Ashton
David Ashton - avatar
+ 3
@Amrit but you didn't mentioned it earlier and till now !
6th Sep 2017, 1:03 PM
Ekansh
+ 2
@Empty so does yours
5th Sep 2017, 8:52 AM
Vari93
Vari93 - avatar
5th Sep 2017, 7:07 PM
ysraelcon
ysraelcon - avatar
+ 1
@Vengat yours reverses the whole string. semi-colons and end of sentence symbols (./?/!) remain in their spots
5th Sep 2017, 8:51 AM
Vari93
Vari93 - avatar
+ 1
@Ekansh and so does yours
5th Sep 2017, 8:53 AM
Vari93
Vari93 - avatar
+ 1
@Calvin yours deletes them completely.
5th Sep 2017, 8:54 AM
Vari93
Vari93 - avatar
+ 1
@Ekansh Yeah there is, he defined words as a sequence of characters separated by a space, semi-colon (;) and complete stops (./?/!).
5th Sep 2017, 9:04 AM
Vari93
Vari93 - avatar
+ 1
this is the SHORTEST one liner solution... https://code.sololearn.com/cGCz34X4qs06/?ref=app
5th Sep 2017, 9:54 AM
sayan chandra
sayan chandra - avatar
+ 1
@Ekansh, maybe Vari is right. To speak on the language of Java, you have to use any non alphanumeric character as delimiter and make it remain in its own position... And @Vari, please compress your replies into one post as Ekansh specified... ^_^
5th Sep 2017, 3:14 PM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar