分类计数(15分)

问题描述

输入一个字符串,请输出这个字符串包含多少个大写字母,多少个小写字

母,多少个数字。

输入格式

输入一行包含一个字符串。

输出格式

输出三行,每行一个整数,分别表示大写字母、小写字母和数字的个数。

样例输入

1+a=Aab

样例输出

1

3

1

import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str=sc.nextLine();
sc.close();
int Big=0;
int small=0;
int digtal=0;
for(int x=0;x<str.length();x++){//1+a=Aab
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);
}
}

我是罡罡同学,一位初入网安的小白。☜(ˆ▽ˆ)

(疯狂暗示 点赞 !关注!发 !!! 点赞 !关注!转发 !!!

* 您的支持是罡罡同学前进的最大动力!