// New Challenge // Reverse sentence | SoloLearn: Learn to code for FREE!

+49

// New Challenge // Reverse sentence

Try to write a code that will reverse the given sentence with your programming language. Example: Input: "I love programming" Output: "programming love I". This is my long, but still working code with c++. https://code.sololearn.com/c1eQna315tz0/?ref=app

11/13/2017 6:21:22 PM

Anahit Harutyunyan

125 Answers

New Answer

+41

https://code.sololearn.com/wb8yL89A2efo/?ref=app

+38

alert(prompt().split(' ').reverse().join(' '))

+30

https://code.sololearn.com/cLM0861Ac1o2/?ref=app EDIT: shortened a bit further

+26

Java in one line : https://code.sololearn.com/c8d7WKEk72la/?ref=app

+21

print(*reversed(input().split())) or print(*input().split()[::-1])

+21

https://code.sololearn.com/cRBCrWe6e5mp/?ref=app

+14

print(" ".join(input().split()[::-1]))

+13

My try Anahit https://code.sololearn.com/c1mtkN67eigp/?ref=app

+12

That feeling when old projects come in handy 😎 https://code.sololearn.com/cNPwkjrpCiUv/?ref=app

+11

here is my try with java8 https://code.sololearn.com/cSfZaHUVtpl8/?ref=app

+11

support?

+9

# Using python https://code.sololearn.com/cch4drb0RwOy/?ref=app

+9

https://code.sololearn.com/cfFVMXO20rVF/?ref=app

+9

Here's mine! https://code.sololearn.com/cQJWgM4LleG2/?ref=app

+8

my three days efforts logic... finally in ruby... https://code.sololearn.com/cZpSX8l9Yr4Z/?ref=app

+7

programming love i https://code.sololearn.com/cf3Wr9rB72K1

+7

Hello new members @Amy @Ella

+7

https://code.sololearn.com/c56kt9xtHkF6/?ref=app

+6

https://code.sololearn.com/c2DiD060RA3m/?ref=app https://code.sololearn.com/coC6D88bSvwa/?ref=app

+6

Mine, just in one line! https://code.sololearn.com/cZVmCTPuNpv6/?ref=app