Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- public class InspirationLab {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int rows = scanner.nextInt();
- int colmuns = scanner.nextInt();
- String[][] matrixOne = new String[rows][colmuns];
- String[][] matrixTwo = new String[rows][colmuns];
- for (int row = 0; row < rows; row++) {
- String[] line = scanner.nextLine().split(" ");
- for (int col = 0; col < colmuns; col++) {
- matrixOne[row][col] = line[col];
- }
- }
- for (int row = 0; row < rows; row++) {
- String[] line2 = scanner.nextLine().split(" ");
- for (int col = 0; col < colmuns; col++) {
- matrixTwo[row][col] = line2[col];
- }
- }
- //TODO<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- for (int i = 0; i < matrixOne.length; i++) {
- String[] firstArr = matrixOne[i];
- String[] secondArr = matrixTwo[i];
- for (int j = 0; j < firstArr.length; j++) {
- String firstElement = firstArr[j];
- String secondElement = secondArr[j];
- if (firstElement != secondElement) {
- System.out.println("*");
- }else{
- System.out.println(firstElement);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement