1259_Palindrome Numbers

hii_·2023년 11월 13일
0

BOG

목록 보기
21/22

알고리즘 안한지 반년이 넘으니까 기억이 하나도 안나서 bufferedreader쓰는거부터 검색해봤다^^
첫날이니까 그런걸로 ~ ㅎ

import java.io.*;

public class BOJ_1259 {
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String str;

        while(true) {
            str = bf.readLine();
            boolean chk = true;

            if(str.equals("0")) break;

            for(int i = 0; i < str.length()/2; i++){
                if(str.charAt(i) != str.charAt(str.length()-i-1))
                    chk = false;
            }

            if(chk) System.out.println("yes");
            else System.out.println("no");
        }
    }
}

첫날은 몸풀기로하쟈,,,🙄

profile
🐢👩‍💻⛄🤍💜

0개의 댓글