Code For Alls..!

get the code!!

Friday, 28 July 2017

Reverse the words-hackerrank-algorithm-solution

Given a string S as the input Write a program to print the reverse order of the words in the string S.

Input Format:
The first line contains S.

Output Format:
The first line contains the words in the reverse order.

Boundary Conditions:
1 <= Length of S <= 100

Example Input/Output 1:
Input:
I Love India

Output:
India Love I

Example Input/Output 2:
Input:
Something must be printed!

Output:
printed! be must Something


python code:

s=input().strip().split()
for x in s[::-1]:

    print(x)