-
Notifications
You must be signed in to change notification settings - Fork 0
/
YT22.java
42 lines (37 loc) · 963 Bytes
/
YT22.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//ChiefTwit@Twitter:Elon Musk 2022
import java.io.*;
public class YT22
{
public static void main(String[] args)throws IOException
{
String str;
int L, x;
String c="", s="", d="", sl="";
InputStreamReader I = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(I);
System.out.println("Enter the string: ");
str=br.readLine();
L=str.length();
for(int i=0; i<L; i++)
{
x=str.charAt(i);
if(x>=65 && x<=90)
{
c=c+(char)x;
}
else if(x>=97 && x<=122)
{
s=s+(char)x;
}
else if(x>=48 && x<=57)
{
d=d+(char)x;
}
else
{
sl=sl+(char)x;
}
}
System.out.println(c+s+d+sl);
}
}