use proconio::{input, marker::Chars}; fn main() { input! { _n: usize, // 文字列の長さ w: usize, // 列数 h: usize, // 行数 s: Chars, // 文字列 } // 出力するグリッド (h,w) let mut grid = vec![vec!['x'; w]; h]; // 現在位置 let mut pos = (0,0); for item in s { if item == 'o' { grid[h - 1 - pos.0][pos.1] = 'o'; pos.0 += 1; } else { pos.0 = 0; pos.1 += 1; } } for i in 0..h { for j in 0..w { print!("{}", grid[i][j]); } println!(); } }