-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEx 2.java
More file actions
46 lines (33 loc) · 833 Bytes
/
Ex 2.java
File metadata and controls
46 lines (33 loc) · 833 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
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scn= new Scanner(System.in);
boolean caps = false;
int n = scn.nextInt();
scn.nextLine();
String[] arr = new String[n];
for(int i = 0; i < n;i++)
{
String tmp = scn.nextLine();
arr[i] = tmp;
}
String Result = "";
for(int i = 0; i < n ; i++)
{
if(arr[i].equals("CAPS"))
{
caps = !caps;
continue;
}
if(caps)
{
Result += arr[i].toUpperCase();
}
else
{
Result += arr[i].toLowerCase();
}
}
System.out.println(Result);
}
}