-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSWEA1989.java
More file actions
55 lines (38 loc) · 1.15 KB
/
SWEA1989.java
File metadata and controls
55 lines (38 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.study.code.solved;
import java.util.Scanner;
public class SWEA1989 {
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
int tcN = sc.nextInt();
for (int tc = 1; tc <= tcN; tc++) {
String word = sc.next();
String[] array_word;
//사실상 가장 간단함
array_word = word.split(""); //배열에 한글자씩 저장하기
for(int i=0;i<array_word.length;i++) { //출력
if(!array_word[i].equals(array_word[array_word.length -1 - i])) {
System.out.println("#" + tc + " " + 0);
break;
}
if(i == array_word.length - i -1) {
if(!array_word[i].equals(array_word[array_word.length -1 - i])) {
System.out.println("#" + tc + " " + 0);
}else {
System.out.println("#" + tc + " " + 1);
}
break;
}else if(i == array_word.length/2) {
if(!array_word[i].equals(array_word[i-1])) {
System.out.println("#" + tc + " " + 0);
}else {
System.out.println("#" + tc + " " + 1);
}
break;
}
}
//System.out.println("#" + tc + " " + ans);
}
sc.close();
}
}