BackJoon Algorithm 팰린드롬인지 확인하기 10988 (Java)

업데이트:
최대 1 분 소요

BackJoon Algorithm - Java

alt

문제

alt

풀이

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Back_10988 {
    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder(br.readLine());

        boolean check = sb.toString().equals(sb.reverse().toString());
        if(check){
            System.out.println(1);
        }
        else{
            System.out.println(0);
        }
        br.close();
    }
}


댓글남기기