use proconio::{input, marker::{Usize1, Chars}}; fn main() { input! { N: usize, L: usize, Q: usize, mut S: [Chars; N], } for _ in 0 .. Q { input!(qtype: usize); match qtype { 1 => { input!(k: Usize1, c: char, d: char); for i in 0 .. N { if S[i][k] == c { S[i][k] = d; } } } 2 => { input!(t: Chars); let ans = (0 .. N).filter(|&i| (0 .. t.len()).all(|j| S[i][j] == t[j] ) ).count(); println!("{ans}"); } _ => unreachable!() } } }