Problem: There are two strings s and t, consisting only of letters a and b. You can make the following operation several times: choose a prefix of s, a prefix of t and swap them. Prefixes can be empty, also a prefix can coincide with a whole string. 

Your task is to find a sequence of operations after which one of the strings consists only of a letters and the other consists only of b letters. The number of operations should be minimized.

Input

The first line contains a string s (1 ≤ |s| ≤ 2·105).

The second line contains a string t (1 ≤ |t| ≤ 2·105).

Here |s| and |t| denote the lengths of s and t, respectively. It is guaranteed that at least one of the strings contains at least one a letter and at least one of the strings contains at least one b letter.

Output

The first line should contain a single integer n (0 ≤ n ≤ 5·105) — the number of operations.

Each of the next n lines should contain two space-separated integers ai, bi — the lengths of prefixes of s and t to swap, respectively.

If there are multiple possible solutions, you can print any of them. It's guaranteed that a solution with given constraints exists.

Examples

Input

bab
bb


Output

2
1 0
1 3


Input

bbbb
aaa


Output

0

Note

In the first example, you can solve the problem in two operations:

  1. Swap the prefix of the first string with length 1 and the prefix of the second string with length 0. After this swap, you'll have strings ab and bbb. 
  2. Swap the prefix of the first string with length 1 and the prefix of the second string with length 3. After this swap, you'll have strings bbbb and a. 



In the second example, the strings are already appropriate, so no operations are needed.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
void FindAnsAB(const string& s, const string& t, vector<pair<int, int>>& ans) {
  bool rv = false;
  int n = s.size(), m = t.size();
  for (int i = n - 1, j = m - 1;;) {
    if (rv) {
      while (i >= 0 && s[i] == 'b') --i;
      while (j >= 0 && t[j] == 'a') --j;
      if (i == -1 && j == -1) break;
      ans.push_back({j + 1, i + 1});
      rv = false;
    } else {
      while (i >= 0 && s[i] == 'a') --i;
      while (j >= 0 && t[j] == 'b') --j;
      if (i == -1 && j == -1) break;
      ans.push_back({i + 1, j + 1});
      rv = true;
    }
  }
}
void FindAnsBA(const string& s, const string& t, vector<pair<int, int>>& ans) {
  bool rv = false;
  int n = s.size(), m = t.size();
  for (int i = n - 1, j = m - 1;;) {
    if (rv) {
      while (i >= 0 && s[i] == 'a') --i;
      while (j >= 0 && t[j] == 'b') --j;
      if (i == -1 && j == -1) break;
      ans.push_back({j + 1, i + 1});
      rv = false;
    } else {
      while (i >= 0 && s[i] == 'b') --i;
      while (j >= 0 && t[j] == 'a') --j;
      if (i == -1 && j == -1) break;
      ans.push_back({i + 1, j + 1});
      rv = true;
    }
  }
}
vector<pair<int, int>> Solve(string& s, string& t) {
  int n = s.size(), m = t.size();
  int ab1 = 0, ba1 = 0, ab2 = 0, ba2 = 0;
  vector<int> vab1, vba1, vab2, vba2;
  for (int i = 0; i + 1 < n; ++i) {
    if (s[i] == 'a' && s[i + 1] == 'b') {
      ++ab1;
      vab1.push_back(i);
    }
    if (s[i] == 'b' && s[i + 1] == 'a') {
      ++ba1;
      vba1.push_back(i);
    }
  }
  for (int i = 0; i + 1 < m; ++i) {
    if (t[i] == 'a' && t[i + 1] == 'b') {
      ++ab2;
      vab2.push_back(i);
    }
    if (t[i] == 'b' && t[i + 1] == 'a') {
      ++ba2;
      vba2.push_back(i);
    }
  }
  int ans = max(ab1, ba2) + max(ab2, ba1);
  int t1 = -1, t2 = -1;
  if (t[0] == 'a') {
    for (int i = 1; i <= ab1; ++i) {
      int ab1left = ab1 - i;
      int ba1left = ba1 - (i - 1);
      int diff = s.back() == t.back() && vab1[i - 1] != n - 1;
      if (max(ab1left, ba2 + i - 1) + max(ba1left, ab2 + i - 1) + diff < ans) {
        ans = max(ab1left, ba2 + i - 1) + max(ba1left, ab2 + i - 1) + diff;
        t1 = vab1[i - 1] + 1;
        t2 = 0;
      }
    }
    for (int i = 1; i <= ba1; ++i) {
      int ab1left = ab1 - i;
      int ba1left = ba1 - i;
      int diff = s.back() == t.back() && vba1[i - 1] != n - 1;
      if (max(ab1left, ba2 + i) + max(ba1left, ab2 + i) + diff < ans) {
        ans = max(ab1left, ba2 + i) + max(ba1left, ab2 + i) + diff;
        t1 = vba1[i - 1] + 1;
        t2 = 0;
      }
    }
    for (int i = 1; i <= ab2; ++i) {
      int ab2left = ab2 - i;
      int ba2left = ba2 - (i - 1);
      int diff = s.back() == t.back() && vab2[i - 1] != m - 1;
      if (max(ab2left, ba1 + i - 1) + max(ba2left, ab1 + i - 1) + diff < ans) {
        ans = max(ab2left, ba1 + i - 1) + max(ba2left, ab1 + i - 1) + diff;
        t1 = 0;
        t2 = vab2[i - 1] + 1;
      }
    }
    for (int i = 1; i <= ba2; ++i) {
      int ab2left = ab2 - i;
      int ba2left = ba2 - i;
      int diff = s.back() == t.back() && vba2[i - 1] != m - 1;
      if (max(ab2left, ba1 + i) + max(ba2left, ab1 + i) + diff < ans) {
        ans = max(ab2left, ba1 + i) + max(ba2left, ab1 + i) + diff;
        t1 = 0;
        t2 = vba2[i - 1] + 1;
      }
    }
    for (int i = 1; i <= ab1; ++i) {
      int ab1left = ab1 - i;
      int ba1left = ba1 - (i - 1);
      int j = (ba2 + i - 1 - ab1left) / 2;
      if (1 <= j && j <= ba2) {
        int ab2left = ab2 - j;
        int ba2left = ba2 - j;
        if (max(ab1left + j, i - 1 + ba2left) +
                max(ba1left + j - 1, ab2left + i - 1) <
            ans) {
          ans = max(ab1left + j, i - 1 + ba2left) +
                max(ba1left + j - 1, ab2left + i - 1);
          t1 = vab1[i - 1] + 1;
          t2 = vba2[j - 1] + 1;
        }
      }
      j = (ab2 + i - ba1left) / 2;
      if (1 <= j && j <= ba2) {
        int ab2left = ab2 - j;
        int ba2left = ba2 - j;
        if (max(ab1left + j, i - 1 + ba2left) +
                max(ba1left + j - 1, ab2left + i - 1) <
            ans) {
          ans = max(ab1left + j, i - 1 + ba2left) +
                max(ba1left + j - 1, ab2left + i - 1);
          t1 = vab1[i - 1] + 1;
          t2 = vba2[j - 1] + 1;
        }
      }
    }
    for (int i = 1; i <= ba1; ++i) {
      int ab1left = ab1 - i;
      int ba1left = ba1 - i;
      int j = (ba2 - 1 + i - ab1left) / 2;
      if (1 <= j && j <= ab2) {
        int ab2left = ab2 - j;
        int ba2left = ba2 - (j - 1);
        if (max(ab1left + j - 1, ba2left + i - 1) +
                max(ba1left + j - 1, ab2left + i) <
            ans) {
          ans = max(ab1left + j - 1, ba2left + i - 1) +
                max(ba1left + j - 1, ab2left + i);
          t1 = vba1[i - 1] + 1;
          t2 = vab2[j - 1] + 1;
        }
      }
      j = (ab2 + i + 1 - ba1left) / 2;
      if (1 <= j && j <= ab2) {
        int ab2left = ab2 - j;
        int ba2left = ba2 - (j - 1);
        if (max(ab1left + j - 1, ba2left + i - 1) +
                max(ba1left + j - 1, ab2left + i) <
            ans) {
          ans = max(ab1left + j - 1, ba2left + i - 1) +
                max(ba1left + j - 1, ab2left + i);
          t1 = vba1[i - 1] + 1;
          t2 = vab2[j - 1] + 1;
        }
      }
    }
  } else {
    for (int i = 1; i <= ab1; ++i) {
      int ab1left = ab1 - i;
      int ba1left = ba1 - (i - 1);
      int diff = s.back() == t.back() && vab1[i - 1] != n - 1;
      if (max(ab1left, ba2 + i - 1) + max(ba1left, ab2 + i) + diff < ans) {
        ans = max(ab1left, ba2 + i - 1) + max(ba1left, ab2 + i) + diff;
        t1 = vab1[i - 1] + 1;
        t2 = 0;
      }
    }
    for (int i = 1; i <= ba1; ++i) {
      int ab1left = ab1 - i;
      int ba1left = ba1 - i;
      int diff = s.back() == t.back() && vba1[i - 1] != n - 1;
      if (max(ab1left, ba2 + i - 1) + max(ba1left, ab2 + i) + diff < ans) {
        ans = max(ab1left, ba2 + i - 1) + max(ba1left, ab2 + i) + diff;
        t1 = vba1[i - 1] + 1;
        t2 = 0;
      }
    }
    for (int i = 1; i <= ab2; ++i) {
      int ab2left = ab2 - i;
      int ba2left = ba2 - i;
      int diff = s.back() == t.back() && vab2[i - 1] != m - 1;
      if (max(ab2left, ba1 + i) + max(ba2left, ab1 + i - 1) + diff < ans) {
        ans = max(ab2left, ba1 + i) + max(ba2left, ab1 + i - 1) + diff;
        t1 = 0;
        t2 = vab2[i - 1] + 1;
      }
    }
    for (int i = 1; i <= ba2; ++i) {
      int ab2left = ab2 - (i - 1);
      int ba2left = ba2 - i;
      int diff = s.back() == t.back() && vba2[i - 1] != m - 1;
      if (max(ab2left, ba1 + i) + max(ba2left, ab1 + i) + diff < ans) {
        ans = max(ab2left, ba1 + i) + max(ba2left, ab1 + i) + diff;
        t1 = 0;
        t2 = vba2[i - 1] + 1;
      }
    }
    for (int i = 1; i <= ab1; ++i) {
      int ab1left = ab1 - i;
      int ba1left = ba1 - (i - 1);
      int j = (ba2 + i - ab1left) / 2;
      if (1 <= j && j <= ba2) {
        int ab2left = ab2 - (j - 1);
        int ba2left = ba2 - j;
        if (max(ab1left + j - 1, i - 1 + ba2left) +
                max(ba1left + j - 1, ab2left + i - 1) <
            ans) {
          ans = max(ab1left + j, i - 1 + ba2left) +
                max(ba1left + j - 1, ab2left + i - 1);
          t1 = vab1[i - 1] + 1;
          t2 = vba2[j - 1] + 1;
        }
      }
      j = (ab2 + i + 1 - ba1left) / 2;
      if (1 <= j && j <= ba2) {
        int ab2left = ab2 - (j - 1);
        int ba2left = ba2 - j;
        if (max(ab1left + j - 1, i - 1 + ba2left) +
                max(ba1left + j - 1, ab2left + i - 1) <
            ans) {
          ans = max(ab1left + j - 1, i - 1 + ba2left) +
                max(ba1left + j - 1, ab2left + i - 1);
          t1 = vab1[i - 1] + 1;
          t2 = vba2[j - 1] + 1;
        }
      }
    }
    for (int i = 1; i <= ba1; ++i) {
      int ab1left = ab1 - i;
      int ba1left = ba1 - i;
      int j = (ba2 + i - ab1left) / 2;
      if (1 <= j && j <= ab2) {
        int ab2left = ab2 - j;
        int ba2left = ba2 - j;
        if (max(ab1left + j - 1, ba2left + i - 1) +
                max(ba1left + j - 1, ab2left + i) <
            ans) {
          ans = max(ab1left + j - 1, ba2left + i - 1) +
                max(ba1left + j - 1, ab2left + i);
          t1 = vba1[i - 1] + 1;
          t2 = vab2[j - 1] + 1;
        }
      }
      j = (ab2 + i + 1 - ba1left) / 2;
      if (1 <= j && j <= ab2) {
        int ab2left = ab2 - j;
        int ba2left = ba2 - (j - 1);
        if (max(ab1left + j - 1, ba2left + i - 1) +
                max(ba1left + j - 1, ab2left + i) <
            ans) {
          ans = max(ab1left + j - 1, ba2left + i - 1) +
                max(ba1left + j - 1, ab2left + i);
          t1 = vba1[i - 1] + 1;
          t2 = vab2[j - 1] + 1;
        }
      }
    }
  }
  vector<pair<int, int>> res;
  if (t1 != -1) {
    string sl = s.substr(0, t1), sr = s.substr(t1);
    string tl = t.substr(0, t2), tr = t.substr(t2);
    res.push_back({t1, t2});
    s = tl + sr;
    t = sl + tr;
    n = s.size();
    m = t.size();
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  int n = s.size(), m = t.size();
  if (s[0] == 'b') {
    for (int i = 0; i < n; ++i) {
      if (s[i] == 'a')
        s[i] = 'b';
      else
        s[i] = 'a';
    }
    for (int i = 0; i < m; ++i) {
      if (t[i] == 'a')
        t[i] = 'b';
      else
        t[i] = 'a';
    }
  }
  string os = s, ot = t;
  s.push_back('a');
  t.push_back('b');
  vector<pair<int, int>> ab = Solve(s, t);
  FindAnsAB(s, t, ab);
  s = os, t = ot;
  s.push_back('b');
  t.push_back('a');
  vector<pair<int, int>> ba = Solve(s, t);
  FindAnsBA(s, t, ba);
  if (ab.size() < ba.size()) {
    cout << ab.size() << "\n";
    for (auto [a, b] : ab) cout << a << " " << b << "\n";
  } else {
    cout << ba.size() << "\n";
    for (auto [a, b] : ba) cout << a << " " << b << "\n";
  }
  return 0;
}