题目描述
思路分析
把字符串转换成字符数组
代码实现
package com.atguigu.lanqiao;import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);String str = sc.next();char[] temp = str.toCharArray();int upper = 0, lower = 0, digit = 0;for (int i = 0; i < temp.length; i++) {if ('A' <= temp[i] && temp[i] <= 'Z') {upper++;} else if ('a' <= temp[i] && temp[i] <= 'z') {lower++;} else if ('0' <= temp[i] && temp[i] <= '9') {digit++;}}System.out.println(upper + " " + lower + " " + digit);}
}