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;
const int inf = (int)1.01e9;
const long long infll = (long long)1.01e18;
const long double eps = 1e-9;
const long double pi = acos((long double)-1);
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int x) { return mrand() % x; }
void precalc() {}
const int maxn = (int)2e5 + 5;
string s, t;
char tmp[maxn];
bool read() {
  if (scanf("%s", tmp) < 1) {
    return false;
  }
  s = tmp;
  scanf("%s", tmp);
  t = tmp;
  return true;
}
vector<pair<int, int>> ans;
int get(const string &s) {
  int res = 0;
  for (int i = 0; i + 1 < ((int)(s).size()); i++) {
    res += (s[i] != s[i + 1]);
  }
  return res;
}
void solve2(string s, string t) {
  bool inv = true;
  if (get(s) < get(t)) {
    swap(s, t);
    inv = false;
  }
  int j = ((int)(t).size()) - 1;
  for (int i = ((int)(s).size()) - 1; i > 0; i--) {
    if (s[i] == s[i - 1]) {
      continue;
    }
    if (j >= 0 && t[j] == s[i]) {
      ans.push_back(inv ? make_pair(j + 1, i) : make_pair(i, j + 1));
      inv = !inv;
      continue;
    }
    while (j > 0 && t[j] == t[j - 1]) {
      j--;
    }
    ans.push_back(inv ? make_pair(max(0, j), i) : make_pair(i, max(0, j)));
    inv = !inv;
    j--;
  }
  while (true) {
    while (j > 0 && t[j] == t[j - 1]) {
      j--;
    }
    if (j <= 0) {
      break;
    }
    ans.push_back(inv ? make_pair(j, 0) : make_pair(0, j));
    inv = !inv;
    j--;
  }
}
int solve1(const string &s, const string &t, bool topr, bool inv) {
  int x = 0;
  for (int i = 0; i < ((int)(s).size()); i++) {
    if (s[i] != (char)('a' + (x & 1))) {
      x++;
    }
  }
  x++;
  int y = 0;
  for (int i = 0; i < ((int)(t).size()); i++) {
    if (t[i] != (char)('a' + ((y & 1) ^ 1))) {
      y++;
    }
  }
  y++;
  if (x == 1) {
    if (y == 1) {
      if (topr) {
        printf("0\n");
      }
      return 0;
    }
    int bi = 1;
    for (int i = 3; i < y; i += 2) {
      if (max(y - i, i) < max(y - bi, bi)) {
        bi = i;
      }
    }
    if (topr) {
      ans.clear();
      int cur = 0;
      for (int i = 0; i < ((int)(t).size()); i++) {
        if (t[i] != (char)('a' + ((cur & 1) ^ 1))) {
          cur++;
        }
        if (cur == bi) {
          ans.push_back(make_pair(((int)(s).size()), i));
          string ns = s + t.substr(i);
          string nt = t.substr(0, i);
          solve2(ns, nt);
          break;
        }
      }
      if (inv) {
        for (int i = 0; i < ((int)(ans).size()); i++) {
          swap(ans[i].first, ans[i].second);
        }
      }
      printf("%d\n", ((int)(ans).size()));
      for (int i = 0; i < ((int)(ans).size()); i++) {
        printf("%d %d\n", ans[i].first, ans[i].second);
      }
      assert(((int)(ans).size()) == max(y - bi, bi));
    }
    return max(y - bi, bi);
  }
  if (y == 1) {
    int bi = 1;
    for (int i = 3; i < x; i += 2) {
      if (max(x - i, i) < max(x - bi, bi)) {
        bi = i;
      }
    }
    if (topr) {
      ans.clear();
      int cur = 0;
      for (int i = 0; i < ((int)(s).size()); i++) {
        if (s[i] != (char)('a' + (cur & 1))) {
          cur++;
        }
        if (cur == bi) {
          ans.push_back(make_pair(i, ((int)(t).size())));
          string ns = s.substr(0, i);
          string nt = t + s.substr(i);
          solve2(ns, nt);
          break;
        }
      }
      if (inv) {
        for (int i = 0; i < ((int)(ans).size()); i++) {
          swap(ans[i].first, ans[i].second);
        }
      }
      printf("%d\n", ((int)(ans).size()));
      for (int i = 0; i < ((int)(ans).size()); i++) {
        printf("%d %d\n", ans[i].first, ans[i].second);
      }
      assert(((int)(ans).size()) == max(x - bi, bi));
    }
    return max(x - bi, bi);
  }
  int bi = 1, bj = 1;
  for (int i = 3; i < x; i += 2) {
    if (max(x - i, y + i - 2) < max(x - bi + bj - 1, y + bi - bj - 1)) {
      bi = i;
      bj = 1;
    }
  }
  for (int i = 3; i < y; i += 2) {
    if (max(x + i - 2, y - i) < max(x - bi + bj - 1, y + bi - bj - 1)) {
      bi = 1;
      bj = i;
    }
  }
  if (topr) {
    ans.clear();
    int cur = 0;
    int ps = -1;
    for (int i = 0; i < ((int)(s).size()); i++) {
      if (s[i] != (char)('a' + (cur & 1))) {
        cur++;
      }
      if (cur == bi) {
        ps = i;
        break;
      }
    }
    int pt = -1;
    cur = 0;
    for (int i = 0; i < ((int)(t).size()); i++) {
      if (t[i] != (char)('a' + ((cur & 1) ^ 1))) {
        cur++;
      }
      if (cur == bj) {
        pt = i;
        break;
      }
    }
    ans.push_back(make_pair(ps, pt));
    string ns = s.substr(0, ps) + t.substr(pt);
    string nt = t.substr(0, pt) + s.substr(ps);
    solve2(ns, nt);
    if (inv) {
      for (int i = 0; i < ((int)(ans).size()); i++) {
        swap(ans[i].first, ans[i].second);
      }
    }
    printf("%d\n", ((int)(ans).size()));
    for (int i = 0; i < ((int)(ans).size()); i++) {
      printf("%d %d\n", ans[i].first, ans[i].second);
    }
    assert(((int)(ans).size()) == max(x - bi + bj - 1, y + bi - bj - 1));
  }
  return max(x - bi + bj - 1, y + bi - bj - 1);
}
void solve() {
  if (solve1(s, t, false, false) < solve1(t, s, false, true)) {
    solve1(s, t, true, false);
  } else {
    solve1(t, s, true, true);
  }
}
int main() {
  precalc();
  while (read()) {
    solve();
  }
  return 0;
}