Problem:
Score : 100 points

Problem Statement

You are given a grid with 2 rows and 3 columns of squares.
The color of the square at the i-th row and j-th column is represented by the character C_{ij}.

Write a program that prints YES if this grid remains the same when rotated 180 degrees, and prints NO otherwise.

Constraints

C_{i,j}(1 \leq i \leq 2, 1 \leq j \leq 3) is a lowercase English letter.

Input

Input is given from Standard Input in the following format:

C_{11}C_{12}C_{13}
C_{21}C_{22}C_{23}

Output

Print YES if this grid remains the same when rotated 180 degrees; print NO otherwise.

Sample Input 1

pot
top

Sample Output 1

YES

This grid remains the same when rotated 180 degrees.

Sample Input 2

tab
bet

Sample Output 2

NO

This grid does not remain the same when rotated 180 degrees.

Sample Input 3

eye
eel

Sample Output 3

NO

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Runtime Error)


import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		long ans = 0;
		int[][] mat = new int[3][n];
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < n; j++) {
				mat[i][j] = scanner.nextInt();
			}
			Arrays.sort(mat[i]);
		}
		int[] r01 = new int[n];
		int[] r12 = new int[n];

		Arrays.fill(r01,1);
		Arrays.fill(r12,1);
		for (int i = n-1,j=n-1; i >= 0 && j>=0;) {
			if (mat[0][i] < mat[1][j]) {
				r01[j] = i + 1;
				j--;
			}else{
				i--;
			}
		}
		for (int i = 0,j=0; i < n && j < n;) {
			if (mat[1][i] < mat[2][j]) {
				r12[i] = n-j;
				i++;
			}else{
				j++;
			}
		}
		for (int i = 0; i < n; i++) {
			ans += r01[i]*r12[i];
		}
		System.out.println(ans);
	}
}