function Main(input) { var line = input.split("\n"); var A = +line[0]; var B = +line[1]; var res = ""; if (A.length != B.length) { res = "NO" } for (var i = 0; i < A.length; i = i + 1) { indexSum += B.indexof(A[i]); elemSum += i; B[i] = null; } res = (indexSum == elemSum) ? "YES" : "NO"; console.log(res); } Main(require("fs").readFileSync("/dev/stdin", "utf8"))