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 const MAX = 2e5 + 41;
int const MAGIC = 10;
char s[MAX];
char t[MAX];
int n, m;
struct State {
  int p, len;
  State(){};
  State(int p, int len) : p(p), len(len){};
};
int getlen(vector<State> &v, int l, int r) {
  int res = 0;
  for (int i = l; i <= r; i++) {
    res += v[i].len;
  }
  return res;
}
vector<pair<int, int> > compress(char *s, int n) {
  vector<pair<int, int> > res;
  int cnt = 1;
  char c = s[1];
  for (int i = 2; i <= n; i++) {
    if (s[i] != c) {
      res.push_back(make_pair(c - 'a', cnt));
      cnt = 1;
      c = s[i];
    } else {
      cnt++;
    }
  }
  res.push_back(make_pair(c - 'a', cnt));
  return res;
}
int const INF = 1e9 + 41;
int getcost(int len1, int len2, bool same) {
  if (len1 > len2) {
    swap(len1, len2);
  }
  if (len2 - len1 > 2) {
    return INF;
  }
  if (len1 == len2) {
    if (!same) {
      return len1 - 1;
    } else {
      return 1 + len1 - 1;
    }
  } else {
    len2--;
    if (len1 == len2) {
      return 1 + len1 - 1;
    } else {
      return 1 + len1;
    }
  }
}
void restate(vector<State> &v) {
  for (int i = 0; i <= (int)v.size() - 2; i++) {
    if (v[i].p == v[i + 1].p) {
      v[i].len += v[i + 1].len;
      v.erase(v.begin() + i + 1);
      break;
    }
  }
}
pair<string, string> proceed(string a, string b, vector<pair<int, int> > ans) {
  pair<string, string> res = make_pair(a, b);
  for (int i = 0; i <= (int)ans.size() - 1; i++) {
    int l1 = ans[i].first;
    int l2 = ans[i].second;
    assert(l1 <= (int)res.first.size() && l2 <= (int)res.second.size());
    string stra = res.first.substr(0, l1);
    string strb = res.second.substr(0, l2);
    res.first.erase(res.first.begin(), res.first.begin() + l1);
    res.second.erase(res.second.begin(), res.second.begin() + l2);
    res.first.insert(0, strb);
    res.second.insert(0, stra);
  }
  return res;
}
void swapprefixes(vector<State> &a, int lena, vector<State> &b, int lenb) {
  vector<State> tmpa;
  tmpa.insert(tmpa.begin(), a.begin(), a.begin() + lena);
  vector<State> tmpb;
  tmpb.insert(tmpb.begin(), b.begin(), b.begin() + lenb);
  a.erase(a.begin(), a.begin() + lena);
  b.erase(b.begin(), b.begin() + lenb);
  a.insert(a.begin(), tmpb.begin(), tmpb.end());
  b.insert(b.begin(), tmpa.begin(), tmpa.end());
}
void solve() {
  n = strlen(s + 1);
  m = strlen(t + 1);
  vector<pair<int, int> > va = compress(s, n);
  vector<pair<int, int> > vb = compress(t, m);
  if ((int)va.size() == 1 && (int)vb.size() == 1) {
    printf("0\n");
    return;
  }
  vector<State> a((int)va.size()), b((int)vb.size());
  for (int i = 0; i <= (int)a.size() - 1; i++) {
    a[i] = State(va[i].first, va[i].second);
  }
  for (int i = 0; i <= (int)b.size() - 1; i++) {
    b[i] = State(vb[i].first, vb[i].second);
  }
  int bva, ba = -1, bab = -1;
  bva = getcost((int)a.size(), (int)b.size(), a[0].p == b[0].p);
  int bvb, bb = -1, baa = -1;
  bvb = getcost((int)a.size(), (int)b.size(), a[0].p == b[0].p);
  for (int i = 0; i <= (int)a.size() - 1; i++) {
    for (int j = -1; j <= min(MAGIC, (int)b.size() - 2); j++) {
      int lena = (int)a.size() - (i + 1) + (j + 1);
      int para = a[i + 1].p;
      if (j != -1) {
        para = b[0].p;
        if (i + 1 < (int)a.size() && b[j].p == a[i + 1].p) {
          lena--;
        }
      }
      int lenb = (int)b.size() + (i + 1) - (j + 1);
      int parb = a[0].p;
      if (a[i].p == b[j + 1].p) {
        lenb--;
      }
      int pans = getcost(lena, lenb, para == parb) + 1;
      if (pans < bva) {
        bva = pans;
        ba = i;
        bab = j;
      }
    }
  }
  swap(a, b);
  for (int i = 0; i <= (int)a.size() - 1; i++) {
    for (int j = -1; j <= min(MAGIC, (int)b.size() - 2); j++) {
      int lena = (int)a.size() - (i + 1) + (j + 1);
      int para = a[i + 1].p;
      if (j != -1) {
        para = b[0].p;
        if (i + 1 < (int)a.size() && b[j].p == a[i + 1].p) {
          lena--;
        }
      }
      int lenb = (int)b.size() + (i + 1) - (j + 1);
      int parb = a[0].p;
      if (a[i].p == b[j + 1].p) {
        lenb--;
      }
      int pans = getcost(lena, lenb, para == parb) + 1;
      if (pans < bvb) {
        bvb = pans;
        bb = i;
        baa = j;
      }
    }
  }
  swap(a, b);
  vector<pair<int, int> > ans;
  if (bva < bvb) {
    if (ba != -1 || bab != -1) {
      ans.push_back(make_pair(getlen(a, 0, ba), getlen(b, 0, bab)));
      swapprefixes(a, ba + 1, b, bab + 1);
    }
  } else {
    if (bb != -1 || baa != -1) {
      ans.push_back(make_pair(getlen(a, 0, baa), getlen(b, 0, bb)));
      swapprefixes(a, baa + 1, b, bb + 1);
    }
  }
  restate(a);
  restate(b);
  assert(abs((int)a.size() - (int)b.size()) <= 2);
  if (abs((int)a.size() - (int)b.size()) == 2 || a[0].p == b[0].p) {
    if ((int)a.size() > (int)b.size()) {
      ans.push_back(make_pair(a[0].len, 0));
      b.insert(b.begin(), a.begin(), a.begin() + 1);
      a.erase(a.begin());
    } else {
      ans.push_back(make_pair(0, b[0].len));
      a.insert(a.begin(), b.begin(), b.begin() + 1);
      b.erase(b.begin());
    }
    restate(a);
    restate(b);
  }
  while (false) {
  };
  int k;
  if ((int)a.size() == (int)b.size()) {
    k = (int)a.size() - 1;
  } else {
    k = min((int)a.size(), (int)b.size());
  }
  while (false) {
  };
  int lena = 0;
  int lenb = 0;
  for (int i = 0; i <= k - 1; i++) {
    lena += a[i].len;
    lenb += b[i].len;
    ans.push_back(make_pair(lena, lenb));
    swap(lena, lenb);
  }
  printf("%d\n", (int)ans.size());
  for (auto z : ans) {
    printf("%d %d\n", z.first, z.second);
  }
}
int main() {
  scanf(" %s", s + 1);
  scanf(" %s", t + 1);
  solve();
  return 0;
}