public class Schar {
public static void main(String[] args) {
String s = "fdAH67%_k.";
int m = 0,k = 0,n = 0;
for(int i = 0;i < s.length();i++) {
char c = s.charAt(i);
if(c >= "a" && c <= "z") {
m++;
}else if(c >= "A" && c <= "Z") {
k++;
}else {
n++;
}
}
System.out.println(m+" "+k+" "+n);
}
}
public static void main(String[] args) {
String s = "fdAH67%_k.";
int m = 0,k = 0,n = 0;
for(int i = 0;i < s.length();i++) {
char c = s.charAt(i);
if(c >= "a" && c <= "z") {
m++;
}else if(c >= "A" && c <= "Z") {
k++;
}else {
n++;
}
}
System.out.println(m+" "+k+" "+n);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货