結果

問題 No.163 cAPSlOCK
ユーザー halship
提出日時 2020-10-22 10:54:57
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 650 bytes
コンパイル時間 13,065 ms
コンパイル使用メモリ 379,292 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-21 09:15:32
合計ジャッジ時間 13,471 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{self, BufReader, BufWriter, Read, Write};

fn main() {
    let stdin = io::stdin();
    let stdin = BufReader::new(stdin.lock());
    let stdout = io::stdout();
    let mut stdout = BufWriter::new(stdout.lock());

    let result: Vec<u8> = stdin
        .bytes()
        .filter_map(|b| b.ok())
        .skip_while(|b| b.is_ascii_whitespace())
        .take_while(|b| !b.is_ascii_whitespace())
        .map(|b| {
            if b.is_ascii_lowercase() {
                b.to_ascii_uppercase()
            } else {
                b.to_ascii_lowercase()
            }
        })
        .collect();

    stdout.write(&result).unwrap();
}
0