-
Notifications
You must be signed in to change notification settings - Fork 0
/
K2UseOfWrapperClass.java
48 lines (48 loc) · 1.19 KB
/
K2UseOfWrapperClass.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
43
44
45
46
47
48
package rank;
import java.util.*;
public class K2UseOfWrapperClass
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for(int i=1;i<=n;i++)
{
String ss=sc.next();
StringBuffer s=new StringBuffer(ss);
if(Character.isUpperCase(s.charAt(0))==true)
{
s.setCharAt(0, Character.toLowerCase(s.charAt(0)));
}
else
{
s.setCharAt(0, Character.toUpperCase(s.charAt(0)));
}
if(Character.isUpperCase(s.charAt(1))==true)
{
s.setCharAt(1, Character.toLowerCase(s.charAt(1)));
}
else
{
s.setCharAt(1, Character.toUpperCase(s.charAt(1)));
}
if(Character.isUpperCase(s.charAt(s.length()-1))==true)
{
s.setCharAt(s.length()-1, Character.toLowerCase(s.charAt(s.length()-1)));
}
else
{
s.setCharAt(s.length()-1, Character.toUpperCase(s.charAt(s.length()-1)));
}
if(Character.isUpperCase(s.charAt(s.length()-2))==true)
{
s.setCharAt(s.length()-2, Character.toLowerCase(s.charAt(s.length()-2)));
}
else
{
s.setCharAt(s.length()-2, Character.toUpperCase(s.charAt(s.length()-2)));
}
System.out.println(s+""+(100+i));
}
}
}