题解 | #牛牛的字符菱形#
牛牛的字符菱形
https://www.nowcoder.com/practice/11a5040fa894430f9d25fda1be37ddc8
use std::io::{self, *}; fn main() { let mut str1 = String::new(); io::stdin().read_line(&mut str1).unwrap(); let mut str1 = str1.trim(); for i in 1..=5 { if i == 1 || i==5{ println!(" {} ",str1) } else if i == 2 || i == 4 { println!(" {}{}{} ",str1,str1,str1) }else { println!("{}{}{}{}{}",str1,str1,str1,str1,str1) } } }