-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathI2_2.java
More file actions
26 lines (24 loc) · 746 Bytes
/
Copy pathI2_2.java
File metadata and controls
26 lines (24 loc) · 746 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
package _string;
import java.util.Scanner;
public class I2_2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String input1 = input.nextLine();
String answer = "";
// for (char c : input1.toCharArray()) {
// if (Character.isUpperCase(c)) {
// answer = answer + Character.toLowerCase(c);
// }else {
// answer = answer + Character.toUpperCase(c);
// }
// }
for (char c : input1.toCharArray()) {
if (c<97) {
answer = answer + (char)(c+32);
}else {
answer = answer + (char)(c-32);
}
}
System.out.println(answer);
}
}