JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
🏆🏆🏆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!!!
(by Kartik Krishnan)
*/
import java.util.*;
public class ReverseWordsInString{
public static void main(String[] args) {
Arrays.asList(new Scanner (System.in).nextLine().split("\\s")). stream().forEach(s-> System.out. printf("%s ", new StringBuffer(s). reverse().toString ()));
}
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run