欧美1区2区3区激情无套,两个女人互添下身视频在线观看,久久av无码精品人妻系列,久久精品噜噜噜成人,末发育娇小性色xxxx

題解 | 判斷各類型字符個(gè)數(shù)

判斷各類型字符個(gè)數(shù)

http://fangfengwang8.cn/practice/4ccc155e474e4d4c83cfde116dcf2218

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int numbers = 0;
        int words = 0;
        int space = 0;
        int other = 0;
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();

        //write your code here......
        int [] arr = getCharCount(str);
        words = arr[0];
        numbers = arr[1];
        space = arr[2];
        other = arr[3];

        System.out.println("英文字母"+words+"數(shù)字"+numbers+"空格"+space+"其他"+other);
    }

    public static int[] getCharCount(String str){
        int [] arr = new int [4];
        char [] chars = str.toCharArray();

        for(char c : chars){
            if(c == ' '){
                arr[2] ++;
            }else if('0' <= c && c <= '9'){
                arr[1] ++;
            }else if('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z'){
                arr[0] ++;
            }else {
                arr[3] ++;
            }
        }

        return arr;
    }
}

全部評(píng)論

相關(guān)推薦

04-06 11:24
已編輯
太原學(xué)院 C++
點(diǎn)贊 評(píng)論 收藏
分享
愛(ài)吃肉的伊登在寫日記:好棒,27屆簡(jiǎn)歷能做成這個(gè)樣子,但是第一個(gè)項(xiàng)目感覺(jué)cover住難度還是不小的,特別是二面的時(shí)候肯定要對(duì)分布式系統(tǒng)設(shè)計(jì)這一塊兒有高出正常面試者的水平才行
點(diǎn)贊 評(píng)論 收藏
分享
評(píng)論
點(diǎn)贊
收藏
分享

創(chuàng)作者周榜

更多
??途W(wǎng)
牛客企業(yè)服務(wù)