题解 | #统计字符#
统计字符
http://www.nowcoder.com/practice/539054b4c33b4776bc350155f7abd8f5
while True:
    try:
        a = input()
        n_char = 0
        n_space = 0
        n_digit = 0
        n_other = 0
        for i in a:
            if i.isalpha():
                n_char += 1
            elif i.isnumeric():
                n_digit += 1
            elif i == ' ':
                n_space += 1
            else:
                n_other += 1
        print('%d\n%d\n%d\n%d' % (n_char, n_space,n_digit,n_other))
    except:
        break
 浩鲸科技二面10人在聊
浩鲸科技二面10人在聊
 
 