- package com.itheima;
- import java.util.Scanner;
- public class Test27{
- public static void main(String[] args) {
-
- Scanner sc = new Scanner(System.in);
-
- String str = sc.nextLine().trim();
-
- int daxie = 0;
- int xiaoxie = 0;
- int shuzi = 0;
-
- for (int i = 0; i < str.length(); i++) {
- char c = str.charAt(i);
- if(c >= 'A' && c <= 'Z' ){
- daxie++;
- }else if(c >= 'a' && c <= 'z' ){
- xiaoxie++;
- }else if(c >= '0' && c <= '9'){
- shuzi++;
- }
- }
- System.out.println(str);
- System.out.println("大写:"+daxie+"个");
- System.out.println("小写:"+xiaoxie+"个");
- System.out.println("数字:"+shuzi+"个");
- }
- }
复制代码 很简单,一个注释都不想写.看不懂就回复.
|