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;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
vector<pair<int, int>> solvesame(vector<int> x, vector<int> y);
vector<pair<int, int>> solvediff(vector<int> x, vector<int> y) {
  vector<pair<int, int>> ret;
  if (((int)(x).size()) <= 1 && ((int)(y).size()) <= 1) return ret;
  if (((int)(x).size()) < ((int)(y).size())) {
    ret = solvediff(y, x);
    for (int i = (0); i < (((int)(ret).size())); ++i)
      swap(ret[i].first, ret[i].second);
    return ret;
  }
  if (((int)(y).size()) <= 1) {
    int nxmove = ((int)(x).size()) / 2;
    bool ymove = ((int)(y).size()) == 1 && nxmove % 2 == 1;
    int xsum = 0;
    for (int i = (0); i < (nxmove); ++i) xsum += x[i];
    ret.push_back(make_pair(xsum, ymove ? y[0] : 0));
    vector<int> nx, ny;
    for (int i = (0); i < (((int)(x).size())); ++i)
      if (i < nxmove)
        ny.push_back(x[i]);
      else
        nx.push_back(x[i]);
    if (((int)(y).size()) == 1)
      if (ymove)
        nx[0] += y[0];
      else
        ny.back() += y[0];
    auto sub = nxmove % 2 == 0 ? solvesame(nx, ny) : solvediff(nx, ny);
    for (int i = (0); i < (((int)(sub).size())); ++i) ret.push_back(sub[i]);
    return ret;
  } else if (((int)(y).size()) == 2) {
    if (((int)(x).size()) == 2) {
      ret.push_back(make_pair(x[0], y[0]));
      return ret;
    } else if (((int)(x).size()) == 3) {
      ret.push_back(make_pair(x[0], y[0]));
      ret.push_back(make_pair(y[0] + x[1], x[0] + y[1]));
      return ret;
    } else if (((int)(x).size()) == 4) {
      ret.push_back(make_pair(x[0], y[0]));
      ret.push_back(make_pair(y[0] + x[1], x[0] + y[1]));
      ret.push_back(make_pair(x[0] + y[1] + x[2], y[0] + x[1]));
      return ret;
    } else if (((int)(x).size()) == 5) {
      ret.push_back(make_pair(x[0] + x[1] + x[2], y[0]));
      ret.push_back(make_pair(y[0] + x[3], x[0]));
      ret.push_back(make_pair(x[0] + x[4], y[0] + x[3] + x[1]));
      return ret;
    } else {
      int xfst = x[0], yfst = y[0], ylst = y[1],
          reps = (((int)(x).size()) - 2) / 4;
      for (int i = (0); i < (reps); ++i) {
        ret.push_back(make_pair(xfst + x[4 * i + 1] + x[4 * i + 2], yfst));
        ret.push_back(make_pair(yfst + x[4 * i + 3], xfst));
        xfst += x[4 * i + 4], yfst += x[4 * i + 1] + x[4 * i + 3],
            ylst += x[4 * i + 2];
      }
      vector<int> nx, ny;
      nx.push_back(xfst);
      for (int i = (4 * reps + 1); i < (((int)(x).size())); ++i)
        nx.push_back(x[i]);
      ny.push_back(yfst);
      ny.push_back(ylst);
      auto sub = solvediff(nx, ny);
      for (int i = (0); i < (((int)(sub).size())); ++i) ret.push_back(sub[i]);
      return ret;
    }
  } else {
    int xfst = x[0], yfst = y[0], reps = ((int)(y).size()) - 2;
    for (int i = (0); i < (reps); ++i) {
      ret.push_back(make_pair(xfst, yfst));
      swap(xfst, yfst);
      xfst += x[i + 1];
      yfst += y[i + 1];
    }
    vector<int> nx, ny;
    nx.push_back(xfst);
    for (int i = (reps + 1); i < (((int)(x).size())); ++i) nx.push_back(x[i]);
    ny.push_back(yfst);
    for (int i = (reps + 1); i < (((int)(y).size())); ++i) ny.push_back(y[i]);
    auto sub = solvediff(nx, ny);
    for (int i = (0); i < (((int)(sub).size())); ++i) ret.push_back(sub[i]);
    return ret;
  }
}
vector<pair<int, int>> solvesame(vector<int> x, vector<int> y) {
  vector<pair<int, int>> ret;
  if (((int)(x).size()) + ((int)(y).size()) <= 1) return ret;
  if (((int)(x).size()) < ((int)(y).size())) {
    ret = solvesame(y, x);
    for (int i = (0); i < (((int)(ret).size())); ++i)
      swap(ret[i].first, ret[i].second);
    return ret;
  }
  if (((int)(y).size()) <= 1) {
    int nxmove = ((int)(x).size()) / 2;
    bool ymove = ((int)(y).size()) == 1 && nxmove % 2 == 0;
    int xsum = 0;
    for (int i = (0); i < (nxmove); ++i) xsum += x[i];
    ret.push_back(make_pair(xsum, ymove ? y[0] : 0));
    vector<int> nx, ny;
    for (int i = (0); i < (((int)(x).size())); ++i)
      if (i < nxmove)
        ny.push_back(x[i]);
      else
        nx.push_back(x[i]);
    if (((int)(y).size()) == 1)
      if (ymove)
        nx[0] += y[0];
      else
        ny.back() += y[0];
    auto sub = nxmove % 2 == 0 ? solvesame(nx, ny) : solvediff(nx, ny);
    for (int i = (0); i < (((int)(sub).size())); ++i) ret.push_back(sub[i]);
    return ret;
  } else if (((int)(x).size()) == 2) {
    ret.push_back(make_pair(x[0], 0));
    ret.push_back(make_pair(x[1], x[0] + y[0]));
    return ret;
  } else if (((int)(x).size()) == 3) {
    if (((int)(y).size()) == 2) {
      ret.push_back(make_pair(x[0], 0));
      ret.push_back(make_pair(x[1], x[0] + y[0]));
      return ret;
    } else {
      ret.push_back(make_pair(x[0], 0));
      ret.push_back(make_pair(x[1], x[0] + y[0]));
      ret.push_back(make_pair(x[0] + y[0] + x[2], x[1] + y[1]));
      return ret;
    }
  } else {
    int xfst = x[0], yfst = y[0], ysnd = y[1],
        reps = (((int)(x).size()) - 2) / 2;
    for (int i = (0); i < (reps); ++i) {
      ret.push_back(make_pair(xfst + x[2 * i + 1], yfst));
      swap(xfst, yfst);
      xfst += x[2 * i + 2];
      ysnd += x[2 * i + 1];
    }
    vector<int> nx, ny;
    nx.push_back(xfst);
    for (int i = (2 * reps + 1); i < (((int)(x).size())); ++i)
      nx.push_back(x[i]);
    ny.push_back(yfst);
    ny.push_back(ysnd);
    for (int i = (2); i < (((int)(y).size())); ++i) ny.push_back(y[i]);
    auto sub = solvesame(nx, ny);
    for (int i = (0); i < (((int)(sub).size())); ++i) ret.push_back(sub[i]);
    return ret;
  }
}
vector<pair<int, int>> solve(string sx, string sy) {
  vector<int> x;
  for (int l = 0, r = l; l < ((int)(sx).size()); l = r) {
    while (r < ((int)(sx).size()) && sx[l] == sx[r]) ++r;
    x.push_back(r - l);
  }
  vector<int> y;
  for (int l = 0, r = l; l < ((int)(sy).size()); l = r) {
    while (r < ((int)(sy).size()) && sy[l] == sy[r]) ++r;
    y.push_back(r - l);
  }
  return sx[0] != sy[0] ? solvediff(x, y) : solvesame(x, y);
}
void run() {
  string sx, sy;
  cin >> sx >> sy;
  auto ans = solve(sx, sy);
  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);
}
bool verify(string x, string y, vector<pair<int, int>> ops) {
  for (int i = (0); i < (((int)(ops).size())); ++i) {
    int xi = ops[i].first, yi = ops[i].second;
    if (xi < 0 || xi > ((int)(x).size()) || yi < 0 || yi > ((int)(y).size()))
      return false;
    string nx = y.substr(0, yi) + x.substr(xi);
    string ny = x.substr(0, xi) + y.substr(yi);
    x = nx, y = ny;
  }
  for (int i = (1); i < (((int)(x).size())); ++i)
    if (x[i] != x[i - 1]) return false;
  for (int i = (1); i < (((int)(y).size())); ++i)
    if (y[i] != y[i - 1]) return false;
  return true;
}
void stress() {
  for (int len = (1); len <= (14); ++len) {
    int nid = (1 << len) * (len + 1);
    vector<vector<int>> adj(nid);
    vector<int> s;
    for (int at = (0); at < (nid); ++at) {
      int alen = at >> len, blen = len - alen, mask = at - (alen << len),
          bmask = mask >> alen, amask = mask - (bmask << alen);
      if (amask == 0 && bmask == (1 << blen) - 1 ||
          bmask == 0 && amask == (1 << alen) - 1)
        s.push_back(at);
      for (int i = (0); i <= (alen); ++i)
        for (int j = (0); j <= (blen); ++j) {
          int nalen = alen - i + j, nblen = blen - j + i,
              nmask = (bmask & ((1 << j) - 1)) | ((amask >> i) << j) |
                      ((amask & ((1 << i) - 1)) << nalen) |
                      ((bmask >> j) << (nalen + i)),
              to = nmask | (nalen << len);
          adj[at].push_back(to);
        }
    }
    vector<int> d(nid, INT_MAX);
    queue<int> q;
    for (int i = (0); i < (((int)(s).size())); ++i) {
      int at = s[i];
      d[at] = 0;
      q.push(at);
    }
    while (!q.empty()) {
      int at = q.front();
      q.pop();
      for (int i = (0); i < (((int)(adj[at]).size())); ++i) {
        int to = adj[at][i];
        if (d[to] == INT_MAX) d[to] = d[at] + 1, q.push(to);
      }
    }
    for (int at = (0); at < (nid); ++at) {
      int alen = at >> len, blen = len - alen, mask = at - (alen << len),
          bmask = mask >> alen, amask = mask - (bmask << alen);
      if (alen == 0 || blen == 0) continue;
      string sa(alen, '?'), sb(blen, '?');
      for (int i = (0); i < (alen); ++i)
        sa[i] = (amask & (1 << i)) == 0 ? 'a' : 'b';
      for (int i = (0); i < (blen); ++i)
        sb[i] = (bmask & (1 << i)) == 0 ? 'a' : 'b';
      vector<pair<int, int>> have = solve(sa, sb);
      int want = d[at];
      if (want != ((int)(have).size())) {
        printf("%s %s: want=%d have=%d\n", sa.c_str(), sb.c_str(), want,
               ((int)(have).size()));
      }
      if (!verify(sa, sb, have)) {
        printf("%s %s: want=%d have=%d\n", sa.c_str(), sb.c_str(), want,
               ((int)(have).size()));
        for (int i = (0); i < (((int)(have).size())); ++i)
          printf("%d %d\n", have[i].first, have[i].second);
      }
    }
  }
}
int main() {
  run();
  return 0;
}