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 get_s[200005];
int get_t[200005];
vector<pair<int, int> > oper;
int again_s[200005];
int again_t[200005];
void calc(char s, char t, int cnt_s, int cnt_t) {
  int now_s = 0, now_t = 0;
  int i;
  for (;;) {
    if ((now_s + 1 >= cnt_s) && (now_t + 1 >= cnt_t)) {
      return;
    }
    if (now_s + 1 == cnt_s) {
      int k = 0;
      int temp = (cnt_t - now_t) / 2;
      memset(again_s, 0, sizeof(again_s));
      memset(again_t, 0, sizeof(again_t));
      for (i = 0; i < temp; i++) {
        k += get_t[now_t];
        again_s[i] = get_t[now_t];
        now_t++;
      }
      int p;
      char kk = 'b';
      if (temp % 2 == 0) {
        kk = 'a';
      }
      bool te = temp % 2;
      if (s != t) te ^= 1;
      if (te) {
        again_s[temp - 1] += get_s[now_s];
        p = 0;
      } else {
        again_t[0] += get_s[now_s];
        p = get_s[now_s];
      }
      oper.push_back(make_pair(p, k));
      int new_cnt_s = temp;
      int new_cnt_t = 0;
      for (;;) {
        again_t[new_cnt_t++] += get_t[now_t++];
        if (now_t == cnt_t) break;
      }
      memcpy(get_s, again_s, sizeof(get_s));
      memcpy(get_t, again_t, sizeof(get_t));
      calc('a', kk, new_cnt_s, new_cnt_t);
      return;
    } else if (now_t + 1 == cnt_t) {
      int k = 0;
      int temp = (cnt_s - now_s) / 2;
      memset(again_s, 0, sizeof(again_s));
      memset(again_t, 0, sizeof(again_t));
      for (i = 0; i < temp; i++) {
        k += get_s[now_s];
        again_t[i] = get_s[now_s];
        now_s++;
      }
      int p;
      char kk = 'b';
      if (temp % 2 == 0) {
        kk = 'a';
      }
      bool te = temp % 2;
      if (s != t) te ^= 1;
      if (te) {
        again_t[temp - 1] += get_t[now_t];
        p = 0;
      } else {
        again_s[0] += get_t[now_t];
        p = get_t[now_t];
      }
      oper.push_back(make_pair(k, p));
      int new_cnt_t = temp;
      int new_cnt_s = 0;
      for (;;) {
        again_s[new_cnt_s++] += get_s[now_s++];
        if (now_s == cnt_s) break;
      }
      memcpy(get_s, again_s, sizeof(get_s));
      memcpy(get_t, again_t, sizeof(get_t));
      calc('a', kk, new_cnt_s, new_cnt_t);
      return;
    } else if (s != t) {
      if (cnt_s - now_s == 2) {
        if (cnt_t - now_t >= 5) {
          if (cnt_s == 2) {
            cnt_s = 3;
            get_s[2] = get_s[1];
            get_s[1] = get_s[0];
            get_s[0] = 0;
            now_s = 1;
          }
          oper.push_back(
              make_pair(get_s[now_s],
                        get_t[now_t] + get_t[now_t + 1] + get_t[now_t + 2]));
          get_s[now_s + 1] += get_t[now_t + 2];
          get_t[now_t + 3] += get_s[now_s];
          get_s[now_s] = get_t[now_t + 1];
          get_s[now_s - 1] = get_t[now_t];
          now_t += 3;
          now_s--;
        }
      } else if (cnt_t - now_t == 2) {
        if (cnt_s - now_s >= 5) {
          if (cnt_t == 2) {
            cnt_t = 3;
            get_t[2] = get_t[1];
            get_t[1] = get_t[0];
            get_t[0] = 0;
            now_t = 1;
          }
          oper.push_back(
              make_pair(get_s[now_s] + get_s[now_s + 1] + get_s[now_s + 2],
                        get_t[now_t]));
          get_t[now_t + 1] += get_s[now_s + 2];
          get_s[now_s + 3] += get_t[now_t];
          get_t[now_t] = get_s[now_s + 1];
          get_t[now_t - 1] = get_s[now_s];
          now_s += 3;
          now_t--;
        }
      }
      oper.push_back(make_pair(get_s[now_s], get_t[now_t]));
      get_s[now_s + 1] += get_t[now_t];
      get_t[now_t + 1] += get_s[now_s];
      now_s++;
      now_t++;
    } else {
      if (cnt_s - now_s > cnt_t - now_t) {
        oper.push_back(
            make_pair(get_s[now_s] + get_s[now_s + 1], get_t[now_t]));
        get_t[now_t + 1] += get_s[now_s + 1];
        get_s[now_s + 2] += get_t[now_t];
        get_t[now_t] = get_s[now_s];
        now_s += 2;
      } else {
        if (cnt_t - now_t == 2) {
          oper.push_back(make_pair(0, get_t[now_t]));
          get_s[now_s] += get_t[now_t];
          now_t++;
          t = '-';
        } else {
          oper.push_back(
              make_pair(get_s[now_s], get_t[now_t] + get_t[now_t + 1]));
          get_s[now_s + 1] += get_t[now_t + 1];
          get_t[now_t + 2] += get_s[now_s];
          get_s[now_s] = get_t[now_t];
          now_t += 2;
        }
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  int i;
  char last_c = '-';
  int cnt_s = -1;
  for (i = 0; i < (int)s.size(); i++) {
    if (s[i] == last_c) {
      get_s[cnt_s]++;
    } else {
      cnt_s++;
      get_s[cnt_s]++;
      last_c = s[i];
    }
  }
  cnt_s++;
  last_c = '-';
  int cnt_t = -1;
  for (i = 0; i < (int)t.size(); i++) {
    if (t[i] == last_c) {
      get_t[cnt_t]++;
    } else {
      cnt_t++;
      get_t[cnt_t]++;
      last_c = t[i];
    }
  }
  cnt_t++;
  calc(s[0], t[0], cnt_s, cnt_t);
  printf("%d\n", (int)oper.size());
  for (i = 0; i < (int)oper.size(); i++) {
    printf("%d %d\n", oper[i].first, oper[i].second);
  }
  return 0;
}