题解 | #统计字符#
统计字符
http://www.nowcoder.com/practice/539054b4c33b4776bc350155f7abd8f5
while (input = readline()) {
const arr = input.split('');
let eng = 0;
let space = 0; // 32
let num = 0; //48-57
let other = 0;
for (let item of arr) {
let code = item.charCodeAt();
if (code >= 65 && code <= 90 || code >=97 && code <=122) {
eng++;
} else if (code == 32) {
space++;
} else if (code >= 48 && code <= 57) {
num++;
} else {
other++;
}
}
print(eng);
print(space);
print(num);
print(other);
}