@@ -0,0 +1,2373 @@
+import java.io.*;%0Aimport java.math.*;%0Aimport java.security.*;%0Aimport java.text.*;%0Aimport java.util.*;%0Aimport java.util.concurrent.*;%0Aimport java.util.regex.*;%0A%0Apublic class Solution %7B%0A    %0A    static char%5B%5D%5B%5D check(int row, int coloumn, char%5B%5D%5B%5D chars)%7B%0A        try%7Bif((chars%5Brow%5D%5Bcoloumn%5D%3Echars%5Brow+1%5D%5Bcoloumn%5D)  &&  (chars%5Brow%5D%5Bcoloumn%5D%3Echars%5Brow-1%5D%5Bcoloumn%5D)%0A              &&  (chars%5Brow%5D%5Bcoloumn%5D%3Echars%5Brow%5D%5Bcoloumn+1%5D)  &&  (chars%5Brow%5D%5Bcoloumn%5D%3Echars%5Brow%5D%5Bcoloumn-1%5D))%7B%0A            chars%5Brow%5D%5Bcoloumn%5D='X';%0A        %7D%7D%0A        catch(Exception e)%7B%7D%0A        return chars;%0A    %7D%0A%0A    // Complete the cavityMap function below.%0A    static String%5B%5D cavityMap(String%5B%5D grid) %7B%0A        int N = grid.length;%0A        /*int%5B%5D%5B%5D nums = new int%5BN%5D%5BN%5D;%0A        for(int i=0;i%3CN;i++)%7B%0A            int k = Integer.parseInt(grid%5Bi%5D);%0A            for(int j=0;j%3CN;j++)%7B%0A                nums%5Bi%5D%5Bj%5D = k%2510;%0A                k/=10;%0A                System.out.println(nums%5Bi%5D%5Bj%5D);%0A            %7D%0A        %7D*/%0A        char%5B%5D%5B%5D chars = new char%5BN%5D%5BN%5D;%0A        for(int i=0;i%3CN;i++)%7B%0A            String k = grid%5Bi%5D;%0A            char%5B%5D c = k.toCharArray();%0A            chars%5Bi%5D = c;%0A        %7D%0A        for(int i=1;i%3CN-1;i++)%7B%0A            for(int j=1;j%3CN-1;j++)%7B%0A                chars =check(i,j,chars);%0A                //System.out.println(%22.%22);%0A            %7D%0A        %7D%0A        String%5B%5D s = new String%5Bgrid.length%5D;%0A        for(int i=0;i%3CN;i++)%7B%0A            String k = new String(chars%5Bi%5D);%0A            s%5Bi%5D=k;%0A        %7D%0A        return s;%0A    %7D%0A%0A    private static final Scanner scanner = new Scanner(System.in);%0A%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv(%22OUTPUT_PATH%22)));%0A%0A        int n = scanner.nextInt();%0A        scanner.skip(%22(%5Cr%5Cn%7C%5B%5Cn%5Cr%5Cu2028%5Cu2029%5Cu0085%5D)?%22);%0A%0A        String%5B%5D grid = new String%5Bn%5D;%0A%0A        for (int i = 0; i %3C n; i++) %7B%0A            String gridItem = scanner.nextLine();%0A            grid%5Bi%5D = gridItem;%0A        %7D%0A%0A        String%5B%5D result = cavityMap(grid);%0A%0A        for (int i = 0; i %3C result.length; i++) %7B%0A            bufferedWriter.write(result%5Bi%5D);%0A%0A            if (i != result.length - 1) %7B%0A                bufferedWriter.write(%22%5Cn%22);%0A            %7D%0A        %7D%0A%0A        bufferedWriter.newLine();%0A%0A        bufferedWriter.close();%0A%0A        scanner.close();%0A    %7D%0A%7D%0A

add CavityMap.java