結果

問題 No.163 cAPSlOCK
コンテスト
ユーザー mottodora
提出日時 2016-10-16 16:23:50
言語 Rust
(1.97.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 0 ms / 5,000 ms
+ 790µs
コード長 474 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 541 ms
コンパイル使用メモリ 185,776 KB
実行使用メモリ 9,904 KB
最終ジャッジ日時 2026-09-28 03:25:26
合計ジャッジ時間 2,336 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn getline() -> String{
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    return ret;
}

fn capslock(c: char) -> String {
    match c {
        c if c.is_uppercase() => c.to_string().to_lowercase(),
        _                     => c.to_string().to_uppercase(),
    }
}

fn convert(string: &str) -> String {
    string.chars().map(capslock).collect::<String>()
}

fn main() {
    let s = getline();

    println!("{}", convert(s.trim()));
}
0