Reverse Characters in a string
Coding Problem Keys
Reverse Characters in a string
Problem Statement
Write a function to reverse all the characters of each word in an input string for example input1, capitalize only the first letter of each word and return the output1.
Input Specification
input1: An input string
Output Specification
Return a string with the characters of each word in the reverse order and print the string with the first letter of each word capitalized.
Example Input/Output 1
Input
Hello World
Output
Olleh Dlrow
Explanation
The reverse of the word "Hello" with its first letter capitalized is "Olleh" and similarly for the word "World", it is "Dlrow". Hence the output string returned is Olleh Dlrow.
Solution
Programming Language: Python 3 Language
a=list(input().split())
for i in range(len(a)):
a[i]=a[i].lower()
print(a[i][::-1].capitalize(),end=" ")
# Published By PKJCODERS
(Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.)
Comments