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(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
using namespace std;
int n, i, j, m;
const int N = 1e6 + 10;
char s[N], t[N];
struct seg {
  int num, len, id;
} p[N * 2], tmp, ss[N], tt[N];
bool operator<(seg a, seg b) { return a.id < b.id; }
set<seg> S, T;
int ans[N * 2][2], answer = 1e9, out[N * 2][2], topo, tops, topt, hhh,
                   swaped = 0;
int calc() {
  while (S.size() > 1 || T.size() > 1) {
    seg sb = (*S.begin()), tb = (*T.begin());
    if (sb.num != tb.num) {
      S.erase(S.begin());
      T.erase(T.begin());
      topo++;
      out[topo][0] = sb.len, out[topo][1] = tb.len;
      if (S.size() >= 1) {
        tb.len += (*S.begin()).len;
        tb.id = 0;
        S.erase(S.begin());
        S.insert(tb);
      } else
        tb.id = 0, S.insert(tb);
      if (T.size() >= 1) {
        sb.len += (*T.begin()).len;
        sb.id = 0;
        T.erase(T.begin());
        T.insert(sb);
      } else
        sb.id = 0, T.insert(sb);
    } else {
      if (S.size() > T.size()) {
        seg sb = (*S.begin());
        S.erase(S.begin());
        topo++;
        out[topo][0] = sb.len, out[topo][1] = 0;
        sb.id = 0;
        sb.len += (*T.begin()).len;
        T.erase(T.begin());
        T.insert(sb);
      } else {
        seg tb = (*T.begin());
        T.erase(T.begin());
        topo++;
        out[topo][0] = 0, out[topo][1] = tb.len;
        tb.id = 0;
        tb.len += (*S.begin()).len;
        S.erase(S.begin());
        S.insert(tb);
      }
    }
  }
  return topo;
}
void adds(seg x) {
  hhh++, x.id = hhh;
  if (S.size() >= 1) {
    set<seg>::iterator it = S.end();
    it--;
    if (x.num == (*it).num) {
      x.len += (*it).len;
      S.erase(it);
      S.insert(x);
    }
    S.insert(x);
  } else
    S.insert(x);
}
void addt(seg x) {
  hhh++, x.id = hhh;
  if (T.size() >= 1) {
    set<seg>::iterator it = T.end();
    it--;
    if (x.num == (*it).num) {
      x.len += (*it).len;
      T.erase(it);
      T.insert(x);
    }
    T.insert(x);
  } else
    T.insert(x);
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  scanf("%s", t + 1);
  m = strlen(t + 1);
  int last = 0, tot = 0, now, top = 0;
  for (i = 1; i <= n + 1; i++) {
    if (s[last] != s[i]) {
      if (tot) {
        top++;
        p[top].id = top;
        p[top].len = tot;
        p[top].num = s[last] - 'a';
        ss[++tops] = p[top];
        last = i, tot = 1;
      } else
        tot = 1, last = 1;
    } else
      tot++;
  }
  last = 0, tot = 0;
  for (i = 1; i <= m + 1; i++) {
    if (t[last] != t[i]) {
      if (tot) {
        top++;
        p[top].id = top;
        p[top].len = tot;
        p[top].num = t[last] - 'a';
        tt[++topt] = p[top];
        last = i, tot = 1;
      } else
        tot = 1, last = 1;
    } else
      tot++;
  }
  ss[0].len = 0, tt[0].len = 0;
  int mid = (tops + topt) / 2, sum = 0;
  if (tops > topt) swap(tops, topt), swap(ss, tt), swaped = 1;
  for (i = 0; i < topt; i++)
    if (abs((topt - i) - (tops + i)) < 4) {
      sum += tt[i].len;
      S.clear(), T.clear();
      hhh = 0;
      if (i) {
        topo = 1;
        out[topo][0] = 0, out[topo][1] = sum;
      } else
        topo = 0;
      for (j = 1; j <= i; j++) adds(tt[j]);
      for (j = i + 1; j <= topt; j++) addt(tt[j]);
      for (j = 1; j <= tops; j++) adds(ss[j]);
      if (calc() < answer) {
        answer = topo;
        for (j = 1; j <= answer; j++)
          ans[j][0] = out[j][0], ans[j][1] = out[j][1];
      }
      if (tops > 1 || i >= 1) {
        S.clear(), T.clear();
        hhh = 0;
        topo = 1;
        out[topo][0] = ss[1].len, out[topo][1] = sum;
        for (j = 1; j <= i; j++) adds(tt[j]);
        addt(ss[1]);
        for (j = i + 1; j <= topt; j++) addt(tt[j]);
        for (j = 2; j <= tops; j++) adds(ss[j]);
        if (calc() < answer) {
          answer = topo;
          for (j = 1; j <= answer; j++)
            ans[j][0] = out[j][0], ans[j][1] = out[j][1];
        }
      }
    } else
      sum += tt[i].len;
  printf("%d\n", answer);
  for (i = 1; i <= answer; i++)
    if (!swaped)
      printf("%d %d\n", ans[i][0], ans[i][1]);
    else
      printf("%d %d\n", ans[i][1], ans[i][0]);
  return 0;
}