SWEA 4579 세상의 모든 팰린드롬 2

1 개요[ | ]

SWEA 4579 세상의 모든 팰린드롬 2
SW Expert 아카데미
# 문제 풀이

틀:SWEA 난이도 3-3

2 C++[ | ]

3 Java[ | ]

import java.util.*;
public class Solution {
	static char[] chs;
	static boolean isExist() {
		int len = chs.length;
		for(int i=0; i<len/2; i++) {
			if( chs[i] == '*' ) return true;
			if( chs[len-1-i] == '*') return true;
			if( chs[i] != chs[len-1-i] ) return false;
		}
		return true;
	}
    public static void main(String[] args) {
   	Scanner sc = new Scanner(System.in);
    	int T = sc.nextInt();
    	for(int tc=1; tc<=T; tc++) {
        	chs = sc.next().toCharArray();
            System.out.format("#%d %s\n", tc, isExist()?"Exist":"Not exist");
        }
        sc.close();
    }
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}