题解 | #统计大写字母个数#
统计大写字母个数
http://www.nowcoder.com/practice/434414efe5ea48e5b06ebf2b35434a9c
use std::io;
fn main() {
let mut s = String::new();
io::stdin().read_line(&mut s).unwrap();
let mut count = 0u8;
for &i in s.as_bytes() {
if i >= 65 && i <= 90 {
count += 1;
}
}
println!("{}", count);
}
用 Rust 刷华为机试HJ 文章被收录于专栏
用 Rust 刷 HJ100 题,只需要懂基础 Rust 语法就能看懂