At the Byteland State University marks are strings of the same length. Mark *x* is considered better than *y* if string *y* is lexicographically smaller than *x*.

Recently at the BSU was an important test work on which Vasya recived the mark *a*. It is very hard for the teacher to remember the exact mark of every student, but he knows the mark *b*, such that every student recieved mark strictly smaller than *b*.

Vasya isn't satisfied with his mark so he decided to improve it. He can swap characters in the string corresponding to his mark as many times as he like. Now he want to know only the number of different ways to improve his mark so that his teacher didn't notice something suspicious.

More formally: you are given two strings *a*, *b* of the same length and you need to figure out the number of different strings *c* such that:

1) *c* can be obtained from *a* by swapping some characters, in other words *c* is a permutation of *a*.

2) String *a* is lexicographically smaller than *c*.

3) String *c* is lexicographically smaller than *b*.

For two strings *x* and *y* of the same length it is true that *x* is lexicographically smaller than *y* if there exists such *i*, that *x*<sub class="lower-index">1</sub> = *y*<sub class="lower-index">1</sub>, *x*<sub class="lower-index">2</sub> = *y*<sub class="lower-index">2</sub>, ..., *x*<sub class="lower-index">*i* - 1</sub> = *y*<sub class="lower-index">*i* - 1</sub>, *x*<sub class="lower-index">*i*</sub> &lt; *y*<sub class="lower-index">*i*</sub>.

Since the answer can be very large, you need to find answer modulo 10<sup class="upper-index">9</sup> + 7.
First line contains string *a*, second line contains string *b*. Strings *a*, *b* consist of lowercase English letters. Their lengths are equal and don't exceed 10<sup class="upper-index">6</sup>.

It is guaranteed that *a* is lexicographically smaller than *b*.
In first sample from string *abc* can be obtained strings *acb*, *bac*, *bca*, *cab*, *cba*, all of them are larger than *abc*, but smaller than *ddd*. So the answer is 5.

In second sample any string obtained from *abcdef* is larger than *abcdeg*. So the answer is 0.
abc
ddd
5
abcdef
abcdeg
0
abacaba
ubuduba
64
aac
bbb
1
aaaccc
bbbbbb
9
aaaaaa
zzzzzz
0
abcde
zzzzz
119
a
c
0
aaa
ccc
0
abacabadaba
dabacabaaba
5586
ujfawuezgiy
vuqvvsivvwe
1730501
jvmzmvqexcqycjcpuqimvyovcffrdwtexpqhxswzytoaokvnexkzgycpmbgvsnyifkwvfbirtwnprmrlotlnhkogjlmxmgruklcuqstwfwoswux
vzsmohqcjpzdhfyjbljviodktdsfbmaujgtsryzlcwdvccykofgxibzrxoqrvfarjduntkenwwqwuvzzxamztghkusejmucljoedfrqpcwunkru
845854724
izybggxalv
rbqjamqnyg
183497
wdtzolgzsx
xnlokxihzw
229771
hoazcxoypk
jdmafdaqwm
116556
qdgvzritpdtoqkq
vlulirhbfjbcmdp
862600433
qszbyqbjgs
qszbyqbjgt
0
ftmhkyguxvbuqaiuxbmj
ftmhkyguxvbuqaiuxbmk
0
dkvctjuqhtotnlwkoiaegcbsigoqvfbjtbhsniksnsauinmcoffbyberonxcpsucpacnaopnjfytkbaqpsxvjppjxzcsrlqkufjt
dkvctjuqhtotnlwkoiaegcbsigoqvfbjtbhsniksnsauinmcoffbyberonxcpsucpacnaopnjfytkbaqpsxvjppjxzcsrlqkufju
0
acehlmnssx
zzzzzzzzzz
1814399
acceeffghhijjjklmmoqqqssstuuwwxyy
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
615090736
aaaabbbcccdeeffffgghhhiiiiijjjjjjjkklllmmnnnnnnooopppqqqqssttuuvvvvwwwxyyzzzzzz
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
56953494
aaaabbbccddddeeeeffffffggggggghhhiijjjjjjjkkkllmmmmmmmmmnnnopppppppqqqqrrrrsssttttuuuuuvvvvvvwwwwwxxxxxyyyyyyyzzz
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
362472550
from typing import List, Set, Dict, Tuple, Text, Optional, Callable, Any
from collections import deque
import collections
from types import GeneratorType
import itertools
import operator
import functools
import random
import copy
import heapq
import math
import sys
import os
from atexit import register
from io import BytesIO, IOBase
import __pypy__  # type: ignore

EPS = 10**-12

################
# INPUT OUTPUT #
################

# From: https://github.com/cheran-senthil/PyRival/blob/master/templates/template_py3.py

BUFSIZE = 8192


class FastIO(IOBase):
  newlines = 0

  def __init__(self, file):
    self._fd = file.fileno()
    self.buffer = BytesIO()
    self.writable = "x" in file.mode or "r" not in file.mode
    self.write = self.buffer.write if self.writable else None

  def read(self):
    while True:
      b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
      if not b:
        break
      ptr = self.buffer.tell()
      self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
    self.newlines = 0
    return self.buffer.read()

  def readline(self):
    while self.newlines == 0:
      b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
      self.newlines = b.count(b"\n") + (not b)
      ptr = self.buffer.tell()
      self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
    self.newlines -= 1
    return self.buffer.readline()

  def flush(self):
    if self.writable:
      os.write(self._fd, self.buffer.getvalue())
      self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
  def __init__(self, file):
    self.buffer = FastIO(file)
    self.flush = self.buffer.flush
    self.writable = self.buffer.writable
    self.write = lambda s: self.buffer.write(s.encode("ascii"))
    self.read = lambda: self.buffer.read().decode("ascii")
    self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


class Input(object):
  def rawInput(self):
    return sys.stdin.readline().rstrip("\r\n")

  def readInt(self):
    return int(self.rawInput())


class Output(object):
  def __init__(self):
    self.out = __pypy__.builders.StringBuilder()

  def write(self, text):
    # type: (str) -> None
    self.out.append(str(text))

  def writeLine(self, text):
    # type: (str) -> None
    self.write(str(text) + '\n')

  def finalize(self):
    sys.stdout.write(self.out.build())
    sys.stdout.flush()


###########
# LIBRARY #
###########


def bootstrap(f, stack=[]):
  # Deep Recursion helper.
  # From: https://github.com/cheran-senthil/PyRival/blob/c1972da95d102d95b9fea7c5c8e0474d61a54378/docs/bootstrap.rst
  # Usage:

  # @bootstrap
  # def recur(n):
  #   if n == 0:
  #     yield 1
  #   yield (yield recur(n-1)) * n
  def wrappedfunc(*args, **kwargs):
    if stack:
      return f(*args, **kwargs)
    else:
      to = f(*args, **kwargs)
      while True:
        if type(to) is GeneratorType:
          stack.append(to)
          to = next(to)
        else:
          stack.pop()
          if not stack:
            break
          to = stack[-1].send(to)
      return to

  return wrappedfunc


int_add = __pypy__.intop.int_add
int_sub = __pypy__.intop.int_sub
int_mul = __pypy__.intop.int_mul


def make_mod_mul(mod):
  fmod_inv = 1.0 / mod

  def mod_mul(a, b, c=0):
    res = int_sub(int_add(int_mul(a, b), c), int_mul(
        mod, int(fmod_inv * a * b + fmod_inv * c)))
    if res >= mod:
      return res - mod
    elif res < 0:
      return res + mod
    else:
      return res

  return mod_mul


def isPrime(number):
  # type: (int) -> bool
  # Return if number is prime.
  # Complexity: n^{0.5}
  '''
  >>> list(map(isPrime, [0, 1, 2, 4, 5, 8, 11, 21, 23]))
  [False, False, True, False, True, False, True, False, True]
  '''

  if number <= 1:
    return False
  if number == 2:
    return True
  if number % 2 == 0:
    return False
  for factor in range(3, int(math.sqrt(number))+1, 2):
    if number % factor == 0:
      return False

  return True


class Combination(object):
  '''
  >>> tp = Combination(10, 11)
  >>> tp.factorial(0)
  1
  >>> tp.factorial(1)
  1
  >>> tp.factorial(2)
  2
  >>> tp.factorial(3)
  6
  >>> tp.factorial(4)
  2
  >>> tp.factorial(10)
  10
  >>> tp.combination(0, 0)
  1
  >>> tp.combination(1, 1)
  1
  >>> tp.combination(10, 1)
  10
  >>> tp.combination(1, 10)
  0
  >>> tp.combination(1, 0)
  1
  >>> tp.combination(10, 0)
  1
  >>> tp.combination(4, 2)
  6
  >>> tp.combination(6, 2)
  4
  >>> tp.combination(10, 8)
  1
  >>> tp.combination(10, 10)
  1
  >>> tp.permutation(0, 0)
  1
  >>> tp.permutation(1, 1)
  1
  >>> tp.permutation(10, 1)
  10
  >>> tp.permutation(1, 10)
  0
  >>> tp.permutation(1, 0)
  1
  >>> tp.permutation(10, 0)
  1
  >>> tp.permutation(4, 2)
  1
  >>> tp.permutation(6, 2)
  8
  >>> tp.permutation(10, 8)
  5
  >>> tp.permutation(10, 10)
  10
  >>> tp = Combination(10, 10)
  >>> tp.factorial(0)
  1
  >>> tp.factorial(1)
  1
  >>> tp.factorial(2)
  2
  >>> tp.factorial(3)
  6
  >>> tp.factorial(4)
  4
  >>> tp.factorial(10)
  0
  >>> tp.combination(0, 0)
  1
  >>> tp.combination(1, 1)
  1
  >>> tp.combination(9, 1)
  9
  >>> tp.combination(10, 1)
  0
  >>> tp.combination(1, 10)
  0
  >>> tp.combination(1, 0)
  1
  >>> tp.combination(10, 0)
  1
  >>> tp.combination(4, 2)
  6
  >>> tp.combination(6, 2)
  5
  >>> tp.combination(10, 8)
  5
  >>> tp.permutation(0, 0)
  1
  >>> tp.permutation(1, 1)
  1
  >>> tp.permutation(10, 1)
  0
  >>> tp.permutation(1, 10)
  0
  >>> tp.permutation(1, 0)
  1
  >>> tp.permutation(10, 0)
  1
  >>> tp.permutation(4, 2)
  2
  >>> tp.permutation(6, 2)
  0
  >>> tp.permutation(10, 8)
  0
  >>> tp.permutation(10, 10)
  0
  '''

  def __init__(self, max_n, modulo):
    # type: (int, int) -> None
    self._max_n = max_n + 5
    if modulo > 2 * 10**9:
      self._mul = lambda a, b: (a*b) % modulo
    else:
      self._mul = make_mod_mul(modulo)
    self._modulo = modulo

    # precompute factorial
    self._factorial = [0] * self._max_n
    self._factorial[0] = 1
    for i in range(1, self._max_n):
      self._factorial[i] = self._mul(self._factorial[i-1], i)

    self._mod_prime = isPrime(modulo)

    if self._mod_prime:
      self._precomputePrimeMod()
    else:
      self._precomputeDp()

  def _precomputePrimeMod(self):
    # compute modular inverses
    n = self._max_n
    modulo = self._modulo

    mod_inverses = [0] * n
    mod_inverses[1] = 1
    for i in range(2, n):
      mod_inverses[i] = (modulo - self._mul(modulo // i,
                         mod_inverses[modulo % i])) % modulo

    factorial_inverses = [0] * n
    factorial_inverses[0] = factorial_inverses[1] = 1

    for i in range(2, n):
      factorial_inverses[i] = self._mul(
          factorial_inverses[i-1], mod_inverses[i])

    self._factorial_inverse = factorial_inverses

  def _precomputeDp(self):
    n = self._max_n  # type: int
    modulo = self._modulo

    # combination DP:
    self._dp_combination = [0] * (n*n)
    dp = self._dp_combination

    # take 0 from any a is 1
    for i in range(n):
      dp[i * n] = 1

    for i in range(1, n):
      for j in range(1, i+1):
        # take j from i
        dp[i * n + j] = (dp[(i-1) * n + j] + dp[(i-1) * n + j - 1]) % modulo

    # combination DP:
    self._dp_permutation = [0] * (n*n)
    dp = self._dp_permutation

    # take 0 from any a is 1
    for i in range(n):
      dp[i * n] = 1

    for i in range(1, n):
      for j in range(1, i+1):
        # take j from i
        dp[i * n + j] = self._mul(dp[(i-1) * n + j - 1], i)

  def combination(self, total, take):
    # type: (int, int) -> int
    assert 0 <= total < self._max_n
    assert 0 <= take < self._max_n
    if self._mod_prime:
      if take > total:
        return 0

      top = self._factorial[total]
      bottom1 = self._factorial_inverse[take]
      bottom2 = self._factorial_inverse[total - take]
      return self._mul(self._mul(top, bottom1), bottom2)
    else:
      return self._dp_combination[total * self._max_n + take]

  def permutation(self, total, take):
    # type: (int, int) -> int
    assert 0 <= total < self._max_n
    assert 0 <= take < self._max_n
    if self._mod_prime:
      if take > total:
        return 0

      top = self._factorial[total]
      bottom = self._factorial_inverse[total - take]
      return self._mul(top, bottom)
    else:
      return self._dp_permutation[total * self._max_n + take]

  def factorial(self, i):
    assert 0 <= i < self._max_n
    return self._factorial[i]


#########
# LOGIC #
#########


def solve(pool, targ):
  # number of permutations of a so that its >= b
  alphas = [0] * 26
  n = len(pool)
  for i in range(n):
    z1 = ord(pool[i]) - ord('a')
    z2 = ord(targ[i]) - ord('a')
    alphas[z1] += 1
    alphas[z2] -= 1

  modu = 10**9+7
  mul = make_mod_mul(modu)

  combin = Combination(10**6, modu)

  res = 0

  for i in range(n-1, -1, -1):
    # first add to the pool
    z2 = ord(targ[i]) - ord('a')
    alphas[z2] += 1
    if not any(map(lambda x: x < 0, alphas)):
      # can use
      total = sum(alphas)
      prec = combin.factorial(total-1)
      for j in alphas:
        prec = mul(prec, combin._factorial_inverse[j])

      for j in range(z2+1, 26):
        if alphas[j]:
          res = (res + mul(prec, alphas[j])) % modu

  return res


def main(inp: Input, out: Output) -> Any:
  initstr = inp.rawInput()
  targetstr = inp.rawInput()

  bigger_than_init = solve(initstr, initstr)
  bigger_than_target = solve(initstr, targetstr)

  alphas = [0] * 26
  pool = initstr
  targ = targetstr
  n = len(pool)
  for i in range(n):
    z1 = ord(pool[i]) - ord('a')
    z2 = ord(targ[i]) - ord('a')
    alphas[z1] += 1
    alphas[z2] -= 1

  result = (bigger_than_init - bigger_than_target)
  if all(map(lambda x: x == 0, alphas)):
    result -= 1

  modu = 10**9+7
  result = (result + modu + modu) % modu

  out.writeLine(result)


###############
# BOILERPLATE #
###############
output_obj = Output()
main(Input(), output_obj)
output_obj.finalize()
