package zuoYe;
import java.util.Scanner;
public class test07 {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
System.out.println("请输入一行字符:");
String str = in.nextLine();
char ch[ ] =null;
ch = str.toCharArray();
int shu = 0;//数字数量
int yw = 0;//英文数量
int kg = 0; //空格个数
int other = 0;//其他个数
for(int i = 0;i<ch.length;i++){
if(ch[i] >= '0' && ch[i] <= '9') {
shu++;
}else if((ch[i] >='a'&&ch[i] <='z')||(ch[i] >='A'&&ch[i] <='Z')){
yw++;
}else if(ch[i]==' '){
kg++;
}else{
other++;
}
}
System.out.println("数字的个数:"+shu);
System.out.println("字母的个数:"+yw);
System.out.println("空格的个数:"+kg);
System.out.println("其他的个数:"+other);
}
}