forked from sherxon/AlgoDS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAntiCAPS.java
More file actions
35 lines (29 loc) · 881 Bytes
/
AntiCAPS.java
File metadata and controls
35 lines (29 loc) · 881 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
package timus;
import java.util.Scanner;
/**
* Created by sherxon on 12/8/16.
*/
public class AntiCAPS {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
StringBuilder builder=new StringBuilder();
char[] a=null;
boolean b=true;
while (in.hasNextLine()){
a=in.nextLine().toCharArray();
for (int i = 0; i < a.length; i++) {
if(b && Character.isAlphabetic(a[i])) {
builder.append(a[i]);
b=false;
}
else
builder.append(Character.toLowerCase(a[i]));
if( a[i] == '.' || a[i] == '!' || a[i] == '?'){
b =true;
}
}
System.out.println(builder);
builder.setLength(0);
}
}
}