Advertisement
AngelGiurov

Untitled

Jul 14th, 2021
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class asfg {
  4. public static void main(String[] args) {
  5. Scanner input = new Scanner(System.in);
  6. int numberOfInputs = Integer.parseInt(input.nextLine());
  7. boolean isSymmetrical = false;
  8. int holdingInt = 0;
  9. for (int i = 0; i < input.nextInt(); i++) {
  10. String[] inputString = input.nextLine().split(" ");
  11. holdingInt = inputString.length - 1;
  12. for (int j = 0; j < inputString.length / 2; j++){
  13. if (inputString[j].equals(inputString[holdingInt])){
  14. isSymmetrical = true;
  15. }else {
  16. isSymmetrical = false;
  17. break;
  18. }
  19. holdingInt--;
  20. }
  21. if (isSymmetrical){
  22. System.out.println("Yes");
  23. }else {
  24. System.out.println("No");
  25. }
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement