aboutsummaryrefslogtreecommitdiff
path: root/challenge-001/zapwai/rust/ch-1.rs
blob: d8c2644bf801635530f121a9d73e36673cff1439 (plain)
1
2
3
4
5
6
7
8
9
10
11
fn main() {
    let s = "Perl Weekly Challenge";
    let cnt = s.chars().filter(|&c| c == 'e').count();
    println!("Input: {s}");
    print!("Output: ");
    for c in s.chars() {
	if c == 'e' { print!("E"); }
	else { print!("{c}"); }
    }
    println!("\ne occurs {cnt} times in the input sentence.");
}