結果

問題 No.273 回文分解
コンテスト
ユーザー yun_app
提出日時 2016-05-11 23:44:41
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 866 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,824 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 44,856 KB
最終ジャッジ日時 2026-03-11 22:10:29
合計ジャッジ時間 3,955 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.*;
import java.lang.*;
import java.io.*;

class Ideone{
    public static void main(String[] args) throws Exception{
        // your code goes here
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        int max = line.length();
        int ans = 1;
        while(max-->0){
            for(int i=0;i<=line.length()-max;i++){
                if(check(line.substring(i,i+max))){
                    System.out.println(max);
                    return;
                }
            }
        }
        System.out.println(1);
    }
    public static boolean check(String line){
        int len = line.length();
        for(int i=0;i<len;i++){
            if(line.charAt(i) != line.charAt(len-i-1)){
                return false;
            }
        }
        return true;
    }
}
0