package com.itheima01;
import java.util.Scanner;
public class zifuchuan {
public static void main(String[] args) {
// TODO Auto-generated method stub
String N;
int ch=0;
int num=0;
int bl=0;
int other=0;
System.out.println("请输入一串字符:");
Scanner sc=new Scanner(System.in);//面向对象程序设计
N=sc.nextLine();
for(int i=0;i<N.length();i++) {
if('A'<=N.charAt(i)&&N.charAt(i)<='Z'||'a'<=N.charAt(i)&&N.charAt(i)<='z')
{
ch++;
} else if('0'<=N.charAt(i)&&N.charAt(i)<='9') {
num++;
}else if(N.charAt(i)==' '){
bl++;
}else {
other++;
}
}
System.out.println("字符串"+N+"中有"+ch+"个字母"+num+"个数字"+bl+"个空格"+other+"个其它");
}
}