-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHello.java
More file actions
40 lines (30 loc) · 806 Bytes
/
Hello.java
File metadata and controls
40 lines (30 loc) · 806 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
40
package basic;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Hello {
public static void main(String[] args)
{
String s = new String();
String myList = new String();
String finalstring = "";
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
s = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
String[] words = s.split("\\s");
for (int i = 0; i < words.length; i++)
{
int n = words[i].length();
myList = "";
for(int j=0;j<n;j++)
{
myList = myList+words[i].charAt(n-(j+1));
}
finalstring = finalstring + myList +" ";
}
System.out.println(finalstring.trim());
}
}