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>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
using namespace std;
vector<pair<long long, long long> > ans;
bool vyh = false;
void tr(vector<pair<long long, long long> > &small,
        vector<pair<long long, long long> > &large, bool inv) {
  pair<long long, long long> F = large.back();
  large.pop_back();
  pair<long long, long long> S = large.back();
  large.pop_back();
  pair<long long, long long> T = small.back();
  pair<long long, long long> aa = make_pair(T.second, F.second + S.second);
  if (inv) swap(aa.first, aa.second);
  small.back().second = F.second;
  small[small.size() - 2].second += S.second;
  large.back().second += T.second;
  ans.push_back(aa);
}
void normir(vector<pair<long long, long long> > &a,
            vector<pair<long long, long long> > &b, bool inv) {
  long long cut = 1;
  while (cut <= b.size()) {
    long long B = b.size() - cut + 1;
    long long A = a.size() + cut - 1;
    if (a.size() == 1) A++;
    if (b.size() == 1) B++;
    if (abs(A - B) <= 1 && !(cut == 1 && b.size() == 1)) {
      long long S = 0;
      for (long long j = 0; j < cut; j++) S += b[b.size() - j - 1].second;
      ans.push_back(make_pair(a.back().second, S));
      if (inv) {
        swap(ans.back().first, ans.back().second);
      }
      pair<long long, long long> p = a.back();
      a.pop_back();
      vector<pair<long long, long long> > rt;
      for (long long i = 0; i < cut - 1; i++) {
        pair<long long, long long> q = b.back();
        b.pop_back();
        rt.push_back(q);
      }
      pair<long long, long long> e = b.back();
      b.pop_back();
      if (a.size())
        a[a.size() - 1].second += e.second;
      else
        a.push_back(e);
      if (b.size())
        b.back().second += p.second;
      else
        b.push_back(p);
      reverse(rt.begin(), rt.end());
      for (long long i = 0; i < rt.size(); i++) a.push_back(rt[i]);
      return;
    }
    cut += 2;
  }
  cut = 1;
  while (cut <= b.size()) {
    long long B = b.size() - cut;
    long long A = a.size() + cut;
    if (a.size() == 1) A++;
    if (b.size() == 1) B++;
    if (abs(A - B) <= 1 && !(cut == 1 && b.size() == 1)) {
      long long S = 0;
      for (long long j = 0; j < cut; j++) S += b[b.size() - j - 1].second;
      ans.push_back(make_pair(0, S));
      if (inv) {
        swap(ans.back().first, ans.back().second);
      }
      vector<pair<long long, long long> > rt;
      for (long long i = 0; i < cut; i++) {
        pair<long long, long long> q = b.back();
        b.pop_back();
        rt.push_back(q);
      }
      reverse(rt.begin(), rt.end());
      for (long long i = 0; i < rt.size(); i++) a.push_back(rt[i]);
      return;
    }
    cut += 2;
  }
}
void solve2(vector<pair<long long, long long> > &a,
            vector<pair<long long, long long> > &b) {
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  vyh = true;
  if (a.size() < b.size())
    normir(a, b, false);
  else if (b.size() < a.size())
    normir(b, a, true);
  long long S = 0;
  for (long long i = 0; i < a.size(); i++) S += a[i].second;
  long long sz = min(a.size(), b.size());
  for (long long i = 0; i < sz - 1; i++) {
    pair<long long, long long> p = a.back();
    a.pop_back();
    pair<long long, long long> q = b.back();
    b.pop_back();
    ans.push_back(make_pair(p.second, q.second));
    a.back().second += q.second;
    b.back().second += p.second;
  }
  if (a.size() == 1 && b.size() == 1) return;
  ans.push_back(make_pair(a.back().second, b.back().second));
  return;
}
void sv(vector<pair<long long, long long> > &a,
        vector<pair<long long, long long> > &b, bool inv) {
  if (b.size() == 2) {
    ans.push_back(make_pair(0, b.back().second));
    if (inv) {
      swap(ans.back().first, ans.back().second);
    }
    return;
  }
  ans.push_back(make_pair(0, b.back().second));
  if (inv) {
    swap(ans.back().first, ans.back().second);
  }
  ans.push_back(
      make_pair(a.back().second + b.back().second, b[b.size() - 2].second));
  if (inv) {
    swap(ans.back().first, ans.back().second);
  }
  return;
}
void s1(vector<pair<long long, long long> > &a,
        vector<pair<long long, long long> > &b, bool inv) {
  if (b.size() <= 3) return;
  if (b.size() % 4 == 2) {
    long long S = 0;
    vector<pair<long long, long long> > rt;
    long long SS = b.size();
    for (long long i = 0; i < SS / 2; i++) {
      rt.push_back(b.back());
      S += b.back().second;
      b.pop_back();
    }
    ans.push_back(make_pair(0, S));
    if (inv) swap(ans.back().first, ans.back().second);
    reverse(rt.begin(), rt.end());
    a.back().second += rt[0].second;
    for (long long i = 1; i < rt.size(); i++) a.push_back(rt[i]);
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    solve2(a, b);
    return;
  }
  long long cut = 2;
  long long S = 0;
  for (long long j = 0; j < cut; j++) S += b[b.size() - j - 1].second;
  ans.push_back(make_pair(a.back().second, S));
  if (inv) {
    swap(ans.back().first, ans.back().second);
  }
  pair<long long, long long> p = a.back();
  a.pop_back();
  vector<pair<long long, long long> > rt;
  for (long long i = 0; i < cut - 1; i++) {
    pair<long long, long long> q = b.back();
    b.pop_back();
    rt.push_back(q);
  }
  pair<long long, long long> e = b.back();
  b.pop_back();
  if (a.size())
    a[a.size() - 1].second += e.second;
  else
    a.push_back(e);
  if (b.size())
    b.back().second += p.second;
  else
    b.push_back(p);
  reverse(rt.begin(), rt.end());
  for (long long i = 0; i < rt.size(); i++) a.push_back(rt[i]);
  return;
}
void solve1(vector<pair<long long, long long> > &a,
            vector<pair<long long, long long> > &b) {
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  if (a.size() == 1 && b.size() == 1) return;
  if (a.size() == 1)
    s1(a, b, false);
  else if (b.size() == 1)
    s1(b, a, true);
  if (vyh) return;
  while (true) {
    if ((long long)min(a.size(), b.size()) < 2 ||
        (long long)max(a.size(), b.size()) == 2)
      break;
    if (a.size() <= b.size())
      tr(a, b, false);
    else
      tr(b, a, true);
  }
  if (a.size() == 2 && b.size() == 2) {
    ans.push_back(
        make_pair(a.back().second, b.back().second + b[b.size() - 2].second));
    ans.push_back(make_pair(b.back().second, 0));
    return;
  }
  if (a.size() == 1)
    sv(a, b, false);
  else
    sv(b, a, true);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s, t;
  cin >> s >> t;
  vector<pair<long long, long long> > a, b;
  char symb = s[0];
  long long how = 1;
  for (long long i = 1; i < s.size(); i++) {
    if (s[i] == symb)
      how++;
    else {
      long long ind = symb - 'a';
      a.push_back(make_pair(ind, how));
      how = 1;
      symb = s[i];
    }
  }
  long long ind = symb - 'a';
  a.push_back(make_pair(ind, how));
  symb = t[0];
  how = 1;
  for (long long i = 1; i < t.size(); i++) {
    if (t[i] == symb)
      how++;
    else {
      long long ind = symb - 'a';
      b.push_back(make_pair(ind, how));
      how = 1;
      symb = t[i];
    }
  }
  ind = symb - 'a';
  b.push_back(make_pair(ind, how));
  if (a[0].first == b[0].first) {
    solve1(a, b);
  } else
    solve2(a, b);
  cout << ans.size() << endl;
  for (long long i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}