题解 | #统计字符#
统计字符
http://www.nowcoder.com/practice/539054b4c33b4776bc350155f7abd8f5
let str; while(str = readline()){ let yw = str.match(/[a-z]/gi)?str.match(/[a-z]/gi).length:0; let kg = str.match(/\s+?/gi)?str.match(/\s+?/gi).length:0; let sz = str.match(/\d/gi)?str.match(/\d/gi).length:0; let qt = str.length - yw - kg - sz; console.log(yw+"\n"+kg+"\n"+sz+"\n"+qt) }