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;
char s1[800010], s2[800010];
char st1[800010], st2[800010];
int cnt1, cnt2;
int las1, las2;
vector<pair<int, int> > ans;
void change(int x1, int x2, char sx1[], char sx2[]) {
  cnt1 = 0, cnt2 = 0;
  int len1 = strlen(sx1 + 1);
  int len2 = strlen(sx2 + 1);
  for (int i = x1 + 1; i <= len1; i++) st1[++cnt1] = sx1[i];
  for (int i = x2 + 1; i <= len2; i++) st2[++cnt2] = sx2[i];
  for (int i = 1; i <= cnt2; i++) sx1[++x1] = st2[i];
  for (int i = 1; i <= cnt1; i++) sx2[++x2] = st1[i];
  sx1[++x1] = 0;
  sx2[++x2] = 0;
}
void change(int x1, int x2) {
  change(x1, x2, s1, s2);
  swap(s1, s2);
}
vector<int> del1, del2;
void work() {
  int len1 = strlen(s1 + 1);
  int len2 = strlen(s2 + 1);
  del1.clear();
  del2.clear();
  for (int i = 1; i <= len1; i++)
    if (s1[i] != s1[i - 1]) del1.push_back(i - 1);
  del1.push_back(len1);
  for (int i = 1; i <= len2; i++)
    if (s2[i] != s2[i - 1]) del2.push_back(i - 1);
  del2.push_back(len2);
  if (del1.size() < del2.size()) {
    int d = (del2.size() - del1.size() + 1) / 2;
    d = (d / 2) * 2;
    if (d >= 0 && del2.size() > d && (d != 0 || del1.size() != 2)) {
      ans.push_back(
          make_pair(del1[1 - (del1.size() == 2 &&
                              (del2.size() % 4 == 1 || del2.size() == 2))],
                    del2[d + 1 -
                         (del1.size() == 2 &&
                          (del2.size() % 4 == 1 || del2.size() == 2))]));
      change(ans[0].first, ans[0].second);
    }
  }
  if (del1.size() > del2.size()) {
    int d = (del1.size() - del2.size() + 1) / 2;
    d = (d / 2) * 2;
    if (d >= 0 && del1.size() > d && (d != 0 || del2.size() != 2)) {
      ans.push_back(make_pair(
          del1[d + 1 -
               (del2.size() == 2 &&
                (del1.size() % 4 == 1 || del1.size() % 4 == 2))],
          del2[1 - (del2.size() == 2 &&
                    (del1.size() % 4 == 1 || del1.size() % 4 == 2))]));
      change(ans[0].first, ans[0].second);
    }
  }
  len1 = strlen(s1 + 1);
  len2 = strlen(s2 + 1);
  del1.clear();
  del2.clear();
  for (int i = 1; i <= len1; i++)
    if (s1[i] != s1[i - 1]) del1.push_back(i - 1);
  for (int i = 1; i <= len2; i++)
    if (s2[i] != s2[i - 1]) del2.push_back(i - 1);
  if (s1[len1] == s2[len2]) {
    if (del1.size() > del2.size())
      del2.push_back(len2);
    else
      del1.push_back(len1);
  }
  int topx = del1.size() - 1;
  int topy = del2.size() - 1;
  bool flag = 0;
  while (topx || topy) {
    if (flag == 0)
      ans.push_back(make_pair(del1[topx], del2[topy]));
    else
      ans.push_back(make_pair(del2[topy], del1[topx]));
    if (topx) topx--;
    if (topy) topy--;
    flag ^= 1;
  }
}
int main() {
  scanf("%s%s", s1 + 1, s2 + 1);
  int len1 = strlen(s1 + 1);
  int len2 = strlen(s2 + 1);
  for (int i = 1; i <= len1; i++)
    if (s1[i] != s1[i - 1]) del1.push_back(i - 1);
  for (int i = 1; i <= len2; i++)
    if (s2[i] != s2[i - 1]) del2.push_back(i - 1);
  if (s1[1] != s2[1]) {
    work();
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); i++)
      printf("%d %d\n", ans[i].first, ans[i].second);
  } else {
    int siz;
    bool prflag = 0;
    if (del2.size() > del1.size()) {
      swap(s1, s2);
      len1 = strlen(s1 + 1);
      len2 = strlen(s2 + 1);
      del1.clear();
      del2.clear();
      for (int i = 1; i <= len1; i++)
        if (s1[i] != s1[i - 1]) del1.push_back(i - 1);
      for (int i = 1; i <= len2; i++)
        if (s2[i] != s2[i - 1]) del2.push_back(i - 1);
      prflag = 1;
    }
    siz = del1[1];
    for (int i = 1; i <= len1; i++) s1[i] = s1[i + siz];
    work();
    int flag = 0;
    for (int i = 0; i < ans.size(); i++) {
      if (i % 2 == 0 && ans[i].first == 0 && flag == 0) {
        ans[i].first += siz;
        flag = 1;
      } else if (i % 2 == 1 && ans[i].second == 0 && flag == 0) {
        ans[i].second += siz;
        flag = 1;
      } else if (i % 2 == 0) {
        if (ans[i].first != 0) ans[i].first += siz;
      } else {
        if (ans[i].second != 0) ans[i].second += siz;
      }
    }
    if (flag == 0) {
      if (ans.size() % 2 == 1)
        ans.push_back(make_pair(0, siz));
      else
        ans.push_back(make_pair(siz, 0));
    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); i++) {
      if (prflag == 1)
        printf("%d %d\n", ans[i].second, ans[i].first);
      else
        printf("%d %d\n", ans[i].first, ans[i].second);
    }
  }
}