Accenture Coding Question | Reverse String Wordwise | CodeWindow

Reverse String Word Wise

Write a function to reverse a string word-wise.

Input specification:
Input 1: String

Output Specification:
Return the reversed string that is the last word in input string should come at the first position of the output string second last word at he second position and so on., individual words should remain same.

Example 1:
Input 1: Welcome to code.
Output : code to Welcome

Explanation:
Reversed string word wise

Example 2:
Input 1: Code to Crack Puzzle
Output : Puzzle Crack tp Code

Explanation:
Reversed string word wise

Solution in Python 3:

#https://codewindow.in
#join our telegram channel

sen=input().split()
rev=sen[::-1]
a=' '.join(rev)
print(a)

# Telegram @codewindow

Output:

codewindow is the best place for IT materials
materials IT for place best the is codewindow
Recent Posts

Leave a Comment

Your email address will not be published. Required fields are marked *