forked from rathoresrikant/HacktoberFestContribute
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaseChange.java
More file actions
31 lines (24 loc) · 791 Bytes
/
CaseChange.java
File metadata and controls
31 lines (24 loc) · 791 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
import java.util.Scanner;
class CaseChange{
static String caseChangeMethod(String inputString){
char c;
String resultString = "";
for(int i=0;i<inputString.length();i++){
c = inputString.charAt(i);
if(c >= 65 && c <= 90)
resultString+= (char)(c+32);
else
if(c >= 97 && c <= 122)
resultString+= (char)(c-32);
else
resultString+= c;
}
return resultString;
}
public static void main(String... X) {
Scanner sc = new Scanner(System.in);
String inputString = sc.nextLine();
inputString=caseChangeMethod(inputString);
System.out.println("Changed : " +inputString);
}
}