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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
// ABBCCBBA max import java.util.Scanner; public class Solution { static char s[][]; static String a; static int N, Answer; public static void main(String[] args){ s = new char[100][100]; Scanner sc = new Scanner(System.in); for(int test_case=1; test_case<11; test_case++){ N = sc.nextInt(); sc.nextLine(); for(int i= 0; i<100; i++){ a = sc.nextLine(); for(int j=0; j<100; j++){ s[i][j] = a.charAt(j); } } int M=2; int max=0; for(int i=0; i<100; i++){ String b = ""; for(int j=0; j<100; j++){ b+=s[i][j]; } while(M<=100){ for(int j=0; j<100-M+1; j++){ String c = b.substring(j, j+M); StringBuilder sb = new StringBuilder(); sb = sb.append(c); String test = sb.reverse().toString(); if(test.equals(c)){ max=M; break; } } M++; } M = max; } for(int i=0; i<100; i++){ String b = ""; for(int j=0; j<100; j++){ b+=s[j][i]; } while(M<=100){ for(int j=0; j<100-M+1; j++){ String c = b.substring(j, j+M); StringBuilder sb = new StringBuilder(); sb = sb.append(c); String test = sb.reverse().toString(); if(test.equals(c)){ max=M; break; } } M++; } M = max; } System.out.println("#" +test_case+ " " + M ); } } }
1 2
Line 3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'java' Line 5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'class'