solution.java 749 字节
Newer Older
每日一练社区's avatar
每日一练社区 已提交
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
import java.util.Scanner;

public class CountAllKind {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        in.close();
        int Big = 0;
        int small = 0;
        int digtal = 0;

        for (int x = 0; x < str.length(); x++) {
            if (str.charAt(x) >= 'a' && str.charAt(x) <= 'z') {
                small++;
            }
            if (str.charAt(x) >= 'A' && str.charAt(x) <= 'Z') {
                Big++;
            }
            if (str.charAt(x) >= '0' && str.charAt(x) <= '9') {
                digtal++;
            }
        }
        System.out.println(Big);
        System.out.println(small);
        System.out.println(digtal);
    }
}