結果

問題 No.2373 wa, wo, n
ユーザー
提出日時 2024-07-18 15:54:11
言語 Rust
(1.83.0 + proconio)
結果
RE  
実行時間 -
コード長 650 bytes
コンパイル時間 14,887 ms
コンパイル使用メモリ 377,696 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 15:54:27
合計ジャッジ時間 13,408 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 35 WA * 1 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

fn g() -> Vec<char> {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	s.trim().chars().collect()
}
fn main() {
	g();
	let s = g();
	let c = "aonw?";
	if !"nw?".contains(s[0]) || !c.contains(s[1]) {
		println!("No");
		return;
	}
	for i in 1..s.len() - 1 {
		if !c.contains(s[i + 1]) {
			println!("No");
			return;
		}
		match (s[i - 1], s[i], s[i + 1]) {
			('w', '?', 'a')
			| ('w', '?', 'o')
			| ('w', 'w', _)
			| ('w', 'n', _)
			| (_, 'w', 'n')
			| (_, 'w', 'w')
			| (_, 'a', 'a')
			| (_, 'a', 'o')
			| (_, 'o', 'a')
			| (_, 'o', 'o') => {
				println!("No");
				return;
			}
			_ => {}
		}
	}
	println!("Yes")
}
0