function Main(input) { var line = input.split("\n"); var A = +line[0]; var B = +line[1]; var res = ""; var indexSum = 0; var elemSum = 0; 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"));