結果

問題 No.2234 palindromer
ユーザー Lisp_CoderLisp_Coder
提出日時 2023-05-01 01:41:21
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 13,858 ms
コンパイル使用メモリ 379,444 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-19 19:41:21
合計ジャッジ時間 14,802 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{self, BufRead};

fn main() {
    let stdin = io::stdin();
    let mut line = String::new();
    stdin.lock().read_line(&mut line).unwrap();
    let a = line.trim();

    let n = a.len();
    for i in 0..=n {
        let b = &a[..i];
        let x = format!("{}{}", a, b.chars().rev().collect::<String>());
        if x == x.chars().rev().collect::<String>() {
            println!("{}", x);
            return;
        }
    }
}
0