Advertisement
SIRAKOV4444

Untitled

May 24th, 2020
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3.  
  4. public class InspirationLab {
  5. public static void main(String[] args) {
  6. Scanner scanner = new Scanner(System.in);
  7.  
  8. int rows = scanner.nextInt();
  9. int colmuns = scanner.nextInt();
  10.  
  11. String[][] matrixOne = new String[rows][colmuns];
  12. String[][] matrixTwo = new String[rows][colmuns];
  13.  
  14. for (int row = 0; row < rows; row++) {
  15. String[] line = scanner.nextLine().split(" ");
  16. for (int col = 0; col < colmuns; col++) {
  17. matrixOne[row][col] = line[col];
  18. }
  19. }
  20. for (int row = 0; row < rows; row++) {
  21. String[] line2 = scanner.nextLine().split(" ");
  22. for (int col = 0; col < colmuns; col++) {
  23. matrixTwo[row][col] = line2[col];
  24. }
  25. }
  26. //TODO<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  27. for (int i = 0; i < matrixOne.length; i++) {
  28. String[] firstArr = matrixOne[i];
  29. String[] secondArr = matrixTwo[i];
  30. for (int j = 0; j < firstArr.length; j++) {
  31. String firstElement = firstArr[j];
  32. String secondElement = secondArr[j];
  33. if (firstElement != secondElement) {
  34. System.out.println("*");
  35. }else{
  36. System.out.println(firstElement);
  37. }
  38. }
  39.  
  40. }
  41.  
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement