본문 바로가기

Algorithm/Baekjoon

[백준_JAVA] 10988 팰린드롬인지 확인하기

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int result = 1;
		String word = sc.next();
		
		for(int i = 0; i < word.length(); i++) {
			char A = word.charAt(i);
			char B = word.charAt(word.length()-1-i);
			if(A != B)
				result = 0;
		}
		System.out.println(result);
		sc.close();
	}
}

'Algorithm > Baekjoon' 카테고리의 다른 글

[백준_JAVA] 10101 삼각형 외우기  (0) 2023.08.15
[백준_JAVA] 2745 진법 변환  (0) 2023.08.13
[백준_JAVA] 10811 바구니 뒤집기  (0) 2023.08.11
[백준_JAVA] 1546 평균  (1) 2023.08.10
[백준_JAVA] 3052 나머지  (0) 2023.08.09