Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings *a* and *b* of equal length are called equivalent in one of the two cases: 
 1.  They are equal. 1.  If we split string *a* into two halves of the same size *a*<sub class="lower-index">1</sub> and *a*<sub class="lower-index">2</sub>, and string *b* into two halves of the same size *b*<sub class="lower-index">1</sub> and *b*<sub class="lower-index">2</sub>, then one of the following is correct: <ol> <li> *a*<sub class="lower-index">1</sub> is equivalent to *b*<sub class="lower-index">1</sub>, and *a*<sub class="lower-index">2</sub> is equivalent to *b*<sub class="lower-index">2</sub> 1.  *a*<sub class="lower-index">1</sub> is equivalent to *b*<sub class="lower-index">2</sub>, and *a*<sub class="lower-index">2</sub> is equivalent to *b*<sub class="lower-index">1</sub> 
As a home task, the teacher gave two strings to his students and asked to determine if they are equivalent.

Gerald has already completed this home task. Now it's your turn!
The first two lines of the input contain two strings given by the teacher. Each of them has the length from 1 to 200 000 and consists of lowercase English letters. The strings have the same length.
# Obtiene N desde standard input
N = 2
ans = 0

A = []
# Obtiene cada A_i desde standard input
for i in range(N):
  s = input()
  A.append(s)

# algoritmo solicitado
def count_similar_pairs(arr):
    n = len(arr)
    if n <= 1:
        return 0
    mid = n // 2

    left_half = arr[:mid]
    right_half = arr[mid:]
    # Dividir y conquistar en las dos mitades
    similar_pairs = count_similar_pairs(left_half) + count_similar_pairs(right_half)

    # si es par, realiza la division y compara
    if (len(arr[0]) % 2 == 0):
        m = len(arr[0])//2
        left_dict = {}
        right_dict = {}
        for word in left_half:
            lword = word[:m]
            rword = word[m:]
            rsorted_word = "".join(sorted(rword))
            lsorted_word = "".join(sorted(lword))

            if lsorted_word+rsorted_word in left_dict:
              left_dict[lsorted_word+rsorted_word] += 1
            elif rsorted_word+lsorted_word in left_dict:
              left_dict[rsorted_word+lsorted_word] += 1
            else:
                left_dict[lsorted_word+rsorted_word] = 1


        for word in right_half:
            lword = word[:m]
            rword = word[m:]
            rsorted_word = "".join(sorted(rword))
            lsorted_word = "".join(sorted(lword))

            if lsorted_word+rsorted_word in right_dict:
              right_dict[lsorted_word+rsorted_word] += 1
            elif rsorted_word+lsorted_word in right_dict:
              right_dict[rsorted_word+lsorted_word] += 1
            else:
                right_dict[lsorted_word+rsorted_word] = 1

        for word, count in left_dict.items():
            lword = word[:m]
            rword = word[m:]
            rsorted_word = "".join(sorted(rword))
            lsorted_word = "".join(sorted(lword))

            if word in right_dict:
              similar_pairs += count * right_dict[word]
              right_dict[word] = 0
            elif (rsorted_word+lsorted_word) in right_dict:
              similar_pairs += right_dict[rsorted_word+lsorted_word]
              right_dict[rsorted_word+lsorted_word] = 0
            else:
              if count > 1:
                similar_pairs += count
        for word, count in right_dict.items():
            if count > 1:
               similar_pairs += count
    # si es impar, comparo cuantas sec son iguales
    if (len(arr[0]) % 2 != 0):
      left_dict = {}
      right_dict = {}

      for word in left_half:
          sorted_word = "".join(sorted(word))
          if sorted_word in left_dict:
              left_dict[sorted_word] += 1
          else:
              left_dict[sorted_word] = 1

      for word in right_half:
          sorted_word = "".join(sorted(word))
          if sorted_word in right_dict:
              right_dict[sorted_word] += 1
          else:
              right_dict[sorted_word] = 1

      for word, count in left_dict.items():
          if word in right_dict:
              similar_pairs += count * right_dict[word]

    return similar_pairs

output = count_similar_pairs(A)
if output == 1:
    print("YES")
else:
    print("NO")
