DevJourney · code I wrote while learning

Reverse each word in a given sentence but maintain the order of words

2 items

README.md

Reverse each word in a given sentence but maintain the order of words

Single File Programming Question

Problem Statement

Alex is working on a text processing tool and needs to reverse each word in a given sentence while maintaining the original word order.

Help Alex by writing a program that takes a sentence as input and outputs the sentence with each word reversed. Use java.lang.StringBuilder to achieve this.

Input:

format :

The input consists of a string.

Output:

format :

The output prints a string representing the modified string after reversing each word in the input.

Refer to the sample output for formatting specifications.

Code constraints : The given test cases fall under the following constraints:

The maximum length of the string is 100.

The string contains spaces, lowercase and uppercase letters.

Sample test cases :

Input 1:

Java Programming
Output 1 :
avaJ gnimmargorP
Input 2 :
Laptop
Output 2 :
potpaL