JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
🏆🏆🏆CHALLENGE🏆🏆🏆 Playing with Strings
This is a modified challenge from another challenge.
Task==> You have to modify the string in such a way that their order remains same but the word itself is reversed.
Example:
Input==> This is a Sololearn Challenge
Output==> sihT si a nraeloloS egnellahC
All The Best!!!
*Author ::: Gaurav Agrawal
*/
import java.util.*;
public class GauravProgram{
public static void main(String[] args){
String ori=new Scanner(System.in).nextLine();
if(ori.length()==0){
System.out.print("enter something :)");
System.exit(0);
}
System.out.print("\nu have entered ::: \n\n"+ori+"\n\n\nafter reversing each word we get :::\n\n"+Sentence_word(ori));
}
static String Sentence_word(String chng){
String retstr="";
String []chngary=chng.trim().split("\\s+");
for(String yeah:chngary){
retstr+=reverse_word(yeah)+" ";}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run