#![allow(dead_code, unused_macros)] macro_rules! ID { ($a: expr, $b: expr) => ($a as usize .. $b as usize) } macro_rules! II { ($a: expr, $b: expr) => ($a as usize .. ($b + 1) as usize) } macro_rules! PR { ($($a: expr),*) => (print! ($($a),*)) } macro_rules! PL { ($($a: expr),*) => (println!($($a),*)) } fn swap(x: &mut T, y: &mut T) { let t = *x; *x = *y; *y = t; } macro_rules! SWAP { ($a: expr, $b: expr) => (swap(&mut $a, &mut $b);) } // ---- ---- fn main() { let mut rd = Read::new(); let r = rd.int(); let k = rd.int() as usize; let mut h = rd.int() as usize; let mut w = rd.int() as usize; let mut c = vec![vec![0__u8; 10]; 10]; for i in ID!(0, h) { c[i] = rd.str().into_bytes(); } for _ in 0..(r / 90) { let mut d = vec![vec![0; 10]; 10]; for i in ID!(0, h) { for j in ID!(0, w) { d[j][h - 1 - i] = c[i][j]; } } SWAP!(h, w); c = d; } for i in ID!(0, h * k) { for j in ID!(0, w * k) { PR!("{}", c[i / k][j / k] as char); } PL!(); } } // ---- ---- struct Read { b: String, v: std::collections::VecDeque, } impl Read { fn new() -> Self { Read { b: String::new(), v: std::collections::VecDeque::new() } } fn str(&mut self) -> String { if self.v.len() == 0 { self.b = String::new(); std::io::stdin().read_line(&mut self.b).unwrap(); self.v = self.b.trim().split(' ').map(|x| x.to_string()).collect(); } self.v.pop_front().unwrap() } fn int(&mut self) -> i64 { self.str().parse().unwrap() } }