슈콩

[SWEA] 세상의 모든 팰린드롬 2 본문

Algorithms/SWEA

[SWEA] 세상의 모든 팰린드롬 2

shukong 2025. 11. 18. 19:53

 

 

[문제]

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWQAz7IqAH8DFAWh

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

 

 

[소스 코드]

import java.io.*;
import java.util.*;
public class Solution {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int T = Integer.parseInt(br.readLine());
		for(int tc=1;tc<=T;tc++) {
			String word = br.readLine();
			String result = "Exist";
			for(int i=0;i<word.length()/2;i++) {
				if(word.charAt(i)!=word.charAt(word.length()-1-i)) {
					if(word.charAt(i)=='*' || word.charAt(word.length()-1-i)=='*') {
						break;
					}
					else {
						result = "Not exist";
						break;
					}
				}
			}
			System.out.println("#"+tc+" "+result);
		}
	}
}

'Algorithms > SWEA' 카테고리의 다른 글

[SWEA] 로봇 언어  (0) 2025.11.18
[SWEA] 승률 비교하기  (0) 2025.11.18
[SWEA] 테네스의 특별한 소수  (0) 2025.11.18
[SWEA] 성공적인 공연 기획  (0) 2025.11.18
[SWEA] 극장 좌석  (0) 2025.11.18