結果

問題 No.1469 programing
ユーザー kenichikenichi
提出日時 2023-12-01 17:23:59
言語 Rust
(1.77.0)
結果
RE  
実行時間 -
コード長 895 bytes
コンパイル時間 10,167 ms
コンパイル使用メモリ 165,828 KB
実行使用メモリ 31,140 KB
最終ジャッジ日時 2023-12-01 17:24:11
合計ジャッジ時間 3,511 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 7 ms
6,676 KB
testcase_09 AC 10 ms
6,676 KB
testcase_10 AC 9 ms
6,676 KB
testcase_11 AC 19 ms
6,676 KB
testcase_12 AC 15 ms
6,676 KB
testcase_13 RE -
testcase_14 AC 26 ms
6,676 KB
testcase_15 AC 16 ms
6,676 KB
testcase_16 AC 26 ms
6,676 KB
testcase_17 AC 255 ms
31,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;
use std::str::FromStr;

fn main() {
    let s: Vec<char> = read_array();
    for _i in 0..s.len() - 1{
        if s[_i] == s[_i + 1]{
            continue;
        }
        print!("{}",s[_i]);
    }
    if s[s.len() - 2] != s[s.len() - 1]{
        print!("{}",s[s.len() - 1]);
    }
    if s[s.len() - 2] == s[s.len() - 1]{
        print!("{}",s[s.len() - 1]);
    }
}

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub fn read_array() -> Vec<char> {
    let array: String = read();
    let chars: Vec<char> = array.trim().chars().collect::<Vec<char>>();
    chars
}
0