forked from NischayKG/My_Java_Programs_of_Strings
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrevstr_using_delemeter.java
More file actions
39 lines (36 loc) · 964 Bytes
/
revstr_using_delemeter.java
File metadata and controls
39 lines (36 loc) · 964 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
import java.util.*;
public class revstr_using_delemeter
{
public static void palat(int t)
{
Scanner scn=new Scanner(System.in);
for(int j=0;j<t;j++)
{
String str=new String();
str=scn.nextLine();
String words[]=str.split("[.]",0);
String revstr="";
int l=words.length;
for(int i=l-1;i>=0;i--)
{
//System.out.println("=fun=");
String temp=words[i];
if(i>0)
{
revstr=revstr+temp+".";
}
else
{
revstr=revstr+temp;
}
}
System.out.println(revstr);
}
}
public static void main (String[] args)
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
palat(t);
}
}