-
Notifications
You must be signed in to change notification settings - Fork 3
/
Alphabet Spam
40 lines (34 loc) · 969 Bytes
/
Alphabet Spam
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 Kattis {
public static void main(String[] args) {
Scanner scan= new Scanner (System.in) ;
String a=scan.nextLine();
char [] b= a.toCharArray();
float kapital=0;
float kecil=0;
float underscore=0;
float simbol=0;
for (int i=0;i<b.length;i++){
if (Character.isUpperCase(b[i])){
kapital= kapital+1;
}
else if (Character.isLowerCase(b[i])){
kecil=kecil+1;
}
else if (b[i]=='_'){
underscore+=1;
}
else {
simbol+=1;
}
}
float e= b.length;
float d=kapital/e ;
float h=kecil/e;
float f=underscore/e;
float g=simbol/e;
System.out.println(f);
System.out.println(h);
System.out.println(d);
System.out.println(g);
}}