小孙


私信TA

用户名:2409244461

访问量:8313

签 名:

这是一个废物

等  级
排  名 295
经  验 5447
参赛次数 1
文章发表 40
年  龄 19
在职情况 学生
学  校 河南工业职业技术学院
专  业 软件技术

  自我简介:

import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int y = 0,k = 0, n = 0 ,c = 0;
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')){
                y++;
            }else if (ch >= '0' && ch<= '9'){
                n++;
            }else if (ch == ' '){
                k++;
            }else{
                c++;
            }
        }
        System.out.println(y);
        System.out.println(k);
        System.out.println(n);
        System.out.println(c);
    }
}


 

0.0分

1 人评分

  评论区