Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.io.*;
- import java.math.*;
- class Solution
- {
- public static void main(String args[])
- {
- Scanner in = new Scanner(System.in);
- char[][] matrix = new char[9][9];
- Map<Integer, Boolean> map = new HashMap<>();
- for (int i = 0; i < 9; i++)
- {
- String w = in.nextLine();
- for(int j = 0; j < 9; j++)
- matrix[i][j] = w.charAt(j);
- }
- for(int i = 0; i < 9; i++)
- {
- for(int k = 1; k <= 9; k++)
- map.put(k,false);
- for(int j = 0; j < 9; j++)
- if(Character.isDigit(matrix[j][i]))
- map.put(matrix[j][i]-'0',true);
- for(int x : map.keySet())
- if(map.get(x) == false)
- System.out.print(x);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement