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;
template <typename T1, typename T2>
inline void chkmin(T1 &x, T2 y) {
  if (x > y) x = y;
}
template <typename T1, typename T2>
inline void chkmax(T1 &x, T2 y) {
  if (x < y) x = y;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const pair<T, U> &_p) {
  _out << _p.first << ' ' << _p.second;
  return _out;
}
template <typename T, typename U>
inline istream &operator>>(istream &_in, pair<T, U> &_p) {
  _in >> _p.first >> _p.second;
  return _in;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const vector<T> &_v) {
  if (_v.empty()) {
    return _out;
  }
  _out << _v.front();
  for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline istream &operator>>(istream &_in, vector<T> &_v) {
  for (auto &_i : _v) {
    _in >> _i;
  }
  return _in;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const set<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const multiset<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const unordered_set<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const unordered_multiset<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const map<T, U> &_m) {
  if (_m.empty()) {
    return _out;
  }
  _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')';
  for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) {
    _out << ", (" << _it->first << ": " << _it->second << ')';
  }
  return _out;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const unordered_map<T, U> &_m) {
  if (_m.empty()) {
    return _out;
  }
  _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')';
  for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) {
    _out << ", (" << _it->first << ": " << _it->second << ')';
  }
  return _out;
}
const string FILENAME = "input";
int reallen(string s) {
  int num1 = 1;
  for (int i = 0; i + 1 < (int)(s).size(); i++) {
    num1 += (s[i] != s[i + 1]);
  }
  return num1;
}
vector<pair<int, int> > solve(string s, string t, int q) {
  s = "a" + s;
  s += ('a' + q);
  t = "b" + t;
  t += ('a' + (1 - q));
  vector<pair<int, int> > ans;
  int num1 = reallen(s);
  int num2 = reallen(t);
  if (num1 == 1 && num2 == 1) {
    return ans;
  }
  vector<int> g1;
  vector<int> g2;
  for (int i = 0; i < (int)(s).size(); i++) {
    if (i == 0 || s[i] != s[i - 1]) {
      g1.push_back(1);
    } else {
      g1[(int)(g1).size() - 1]++;
    }
  }
  g1[0]--;
  g1[(int)(g1).size() - 1]--;
  for (int i = 0; i < (int)(t).size(); i++) {
    if (i == 0 || t[i] != t[i - 1]) {
      g2.push_back(1);
    } else {
      g2[(int)(g2).size() - 1]++;
    }
  }
  g2[0]--;
  g2[(int)(g2).size() - 1]--;
  if ((int)(g1).size() == 1) {
    g1.push_back(0);
    g1.push_back(0);
  } else if ((int)(g2).size() == 1) {
    g2.push_back(0);
    g2.push_back(0);
  }
  if (((int)(g1).size() - (int)(g2).size()) % 4 != 0) {
    g1.push_back(0);
    g1.push_back(0);
  }
  if ((int)(g1).size() != (int)(g2).size()) {
    int a1 = ((int)(g1).size() + 1) / 2;
    int a2 = ((int)(g2).size() + 1) / 2;
    vector<int> newg1;
    vector<int> newg2;
    int sum1 = 0;
    int sum2 = 0;
    for (int j = 0; j < a1; j++) {
      sum1 += g1[j];
      newg1.push_back(g1[j]);
    }
    for (int j = 0; j < a2; j++) {
      sum2 += g2[j];
      newg2.push_back(g2[j]);
    }
    ans.push_back({sum1, sum2});
    for (int j = a1; j < (int)(g1).size(); j++) {
      if (j == a1) {
        newg2[(int)(newg2).size() - 1] += g1[j];
      } else {
        newg2.push_back(g1[j]);
      }
    }
    for (int j = a2; j < (int)(g2).size(); j++) {
      if (j == a2) {
        newg1[(int)(newg1).size() - 1] += g2[j];
      } else {
        newg1.push_back(g2[j]);
      }
    }
    g1 = newg1;
    g2 = newg2;
  }
  int psum1 = 0;
  int psum2 = 0;
  for (int z = 1; z < (int)(g1).size(); z++) {
    psum1 += g1[z - 1];
    psum2 += g2[z - 1];
  }
  for (int z = (int)(int)(g1).size() - 1; z >= 1; z--) {
    ans.push_back({psum1, psum2});
    psum1 -= g1[z - 1];
    psum2 -= g2[z - 1];
  }
  for (int i = 0; i < (int)(ans).size(); i++) {
    if (i % 2) {
      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;
  vector<pair<int, int> > c(700000, {-1, -1});
  for (int r = 0; r < 2; r++) {
    for (int z = 0; z < 2; z++) {
      vector<pair<int, int> > ans = solve(s, t, z);
      if (r == 1) {
        for (int i = 0; i < (int)(ans).size(); i++) {
          swap(ans[i].first, ans[i].second);
        }
      }
      if ((int)(ans).size() <= (int)(c).size()) {
        c = ans;
      }
    }
    swap(s, t);
  }
  cout << (int)(c).size() << '\n';
  for (int i = 0; i < (int)(c).size(); i++) {
    cout << c[i].first << ' ' << c[i].second << '\n';
  }
  return 0;
}