๐Ÿ•ธ Algorithm/๐Ÿ•ธ ๋ฐฑ์ค€ BaekJoon

[๋ฐฑ์ค€][java][10988][ํŒฐ๋ฆฐ๋“œ๋กฌ์ธ์ง€ ํ™•์ธํ•˜๊ธฐ]

๋‰ด์ด NUEY 2024. 2. 7. 04:44
๋ฐ˜์‘ํ˜•

import java.util.Scanner;

// 	10988	ํŒฐ๋ฆฐ๋“œ๋กฌ์ธ์ง€ ํ™•์ธํ•˜๊ธฐ
public class CheckingPalindrome {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		in.close();
		int sL = s.length();
		int res = 1;
		
		for (int i = 0; i < sL; i++) {
			if (s.charAt(i) != s.charAt(sL -1 - i)) {
				res = 0;
			}
		}
		
		System.out.println(res);
	}
}
๋ฐ˜์‘ํ˜•