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 "-O3"
using namespace std;
vector<pair<int, int>> get(string s, string t) {
  while (!s.empty() && s.back() == 'a') s.pop_back();
  while (!t.empty() && t.back() == 'b') t.pop_back();
  int cnt = 0;
  vector<int> sv;
  vector<int> tv;
  for (int i = 0; i < s.size(); ++i) {
    ++cnt;
    if (i == s.size() - 1 || s[i + 1] != s[i]) sv.push_back(cnt), cnt = 0;
  }
  cnt = 0;
  for (int i = 0; i < t.size(); ++i) {
    ++cnt;
    if (i == t.size() - 1 || t[i + 1] != t[i]) tv.push_back(cnt), cnt = 0;
  }
  reverse(sv.begin(), sv.end());
  reverse(tv.begin(), tv.end());
  if (sv.empty() && tv.empty()) {
    return {};
  }
  int fl = 0;
  if (tv.empty()) swap(tv, sv), fl = 1;
  vector<pair<int, int>> ans;
  if (sv.empty()) {
    if (tv.size() % 4 == 0) {
      int sum = tv[tv.size() / 2];
      for (int i = tv.size() / 2 + 1; i < tv.size(); ++i) {
        sum += tv[i];
        sv.push_back(tv[i]);
      }
      tv.resize(tv.size() / 2);
      ans.emplace_back(0, sum);
    } else if (tv.size() % 4 == 1) {
      int sum = tv[tv.size() / 2];
      for (int i = tv.size() / 2 + 1; i < tv.size(); ++i) {
        sum += tv[i];
        sv.push_back(tv[i]);
      }
      tv.resize(tv.size() / 2);
      ans.emplace_back(0, sum);
    } else if (tv.size() % 4 == 2) {
      int sum = 0;
      for (int i = tv.size() / 2; i < tv.size(); ++i) {
        sum += tv[i];
        sv.push_back(tv[i]);
      }
      tv.resize(tv.size() / 2);
      ans.emplace_back(0, sum);
    } else {
      int sum = 0;
      for (int i = tv.size() / 2; i < tv.size(); ++i) {
        sum += tv[i];
        sv.push_back(tv[i]);
      }
      tv.resize(tv.size() / 2);
      ans.emplace_back(0, sum);
    }
  }
  while (!sv.empty() && !tv.empty()) {
    if (sv.size() == 1) {
      if (tv.size() == 1) {
        ans.emplace_back(sv.back(), tv.back());
        sv.pop_back();
        tv.pop_back();
        continue;
      }
      if (tv.size() % 2 == 0) {
        ans.emplace_back(sv.back(), tv.back() + tv[tv.size() - 2]);
        if (tv.size() > 2) tv[tv.size() - 3] += sv.back();
        sv.pop_back();
        sv.push_back(tv.back());
        tv.pop_back();
        tv.pop_back();
      } else {
        ans.emplace_back(sv.back(),
                         tv.back() + tv[tv.size() - 2] + tv[tv.size() - 3]);
        if (tv.size() > 3) tv[tv.size() - 4] += sv.back();
        sv.pop_back();
        sv.push_back(tv[tv.size() - 2]);
        sv.push_back(tv.back());
        tv.pop_back();
        tv.pop_back();
        tv.pop_back();
      }
    } else if (tv.size() == 1) {
      if (sv.size() % 2 == 0) {
        ans.emplace_back(sv.back() + sv[sv.size() - 2], tv.back());
        if (sv.size() > 2) sv[sv.size() - 3] += tv.back();
        tv.pop_back();
        tv.push_back(sv.back());
        sv.pop_back();
        sv.pop_back();
      } else {
        ans.emplace_back(sv.back() + sv[sv.size() - 2] + sv[sv.size() - 3],
                         tv.back());
        if (sv.size() > 3) sv[sv.size() - 4] += tv.back();
        tv.pop_back();
        tv.push_back(sv[sv.size() - 2]);
        tv.push_back(sv.back());
        sv.pop_back();
        sv.pop_back();
        sv.pop_back();
      }
    } else if (sv.size() % 2 == tv.size() % 2) {
      ans.emplace_back(sv.back(), tv.back());
      tv[tv.size() - 2] += sv.back();
      sv[sv.size() - 2] += tv.back();
      sv.pop_back();
      tv.pop_back();
    } else {
      if (sv.size() <= tv.size()) {
        ans.emplace_back(sv.back(), tv.back() + tv[tv.size() - 2]);
        sv[sv.size() - 2] += tv[tv.size() - 2];
        tv[tv.size() - 3] += sv.back();
        sv.pop_back();
        sv.push_back(tv.back());
        tv.pop_back();
        tv.pop_back();
      } else {
        ans.emplace_back(sv.back() + sv[sv.size() - 2], tv.back());
        tv[tv.size() - 2] += sv[sv.size() - 2];
        sv[sv.size() - 3] += tv.back();
        tv.pop_back();
        tv.push_back(sv.back());
        sv.pop_back();
        sv.pop_back();
      }
    }
  }
  if (sv.empty()) {
    if (tv.size() == 1) {
      ans.emplace_back(0, tv.back());
    } else if (tv.size() == 2) {
      ans.emplace_back(0, tv.back() + tv[tv.size() - 2]);
      ans.emplace_back(tv.back(), 0);
    }
  } else {
    if (sv.size() == 1) {
      ans.emplace_back(sv.back(), 0);
    } else if (sv.size() == 2) {
      ans.emplace_back(sv.back() + sv[sv.size() - 2], 0);
      ans.emplace_back(0, sv.back());
    }
  }
  if (fl) {
    for (int i = 0; i < ans.size(); ++i) swap(ans[i].first, ans[i].second);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  string s, t;
  cin >> s >> t;
  auto vv = get(s, t);
  auto vv2 = get(t, s);
  if (vv2.size() < vv.size()) {
    vv = vv2;
    for (int i = 0; i < vv.size(); ++i) swap(vv[i].first, vv[i].second);
  }
  cout << vv.size() << "\n";
  for (auto e : vv) {
    cout << e.first << " " << e.second << "\n";
  }
  return 0;
}