結果
問題 |
No.163 cAPSlOCK
|
ユーザー |
![]() |
提出日時 | 2017-12-31 19:23:18 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 444 bytes |
コンパイル時間 | 17,397 ms |
コンパイル使用メモリ | 377,628 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-21 15:32:38 |
合計ジャッジ時間 | 17,031 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
warning: unused variable: `s` --> src/main.rs:4:9 | 4 | let s = s.chars() | ^ help: if this is intentional, prefix it with an underscore: `_s` | = note: `#[warn(unused_variables)]` on by default
ソースコード
fn main() { let s = read::<String>(); let mut st = String::new(); let s = s.chars() .map(|c| if c.is_uppercase() { c.to_lowercase().nth(0) } else { c.to_uppercase().nth(0) }) .map(|c| c.unwrap()) .fold((), |_, c| { st.push(c) }); println!("{}", st); } fn read<T: std::str::FromStr>() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() }