#include <bits/stdc++.h>
using namespace std;
inline bool SR(int &x) { return scanf("%d", &x) == 1; }
inline bool SR(long long &x) { return scanf("%lld", &x) == 1; }
inline bool SR(double &x) { return scanf("%lf", &x) == 1; }
inline bool SR(char *s) { return scanf("%s", s) == 1; }
inline bool RI() { return true; }
template <typename I, typename... T>
inline bool RI(I &x, T &...tail) {
  return SR(x) && RI(tail...);
}
inline void SP(const int x) { printf("%d", x); }
inline void SP(const long long x) { printf("%lld", x); }
inline void SP(const double x) { printf("%.16lf", x); }
inline void SP(const char *s) { printf("%s", s); }
inline void PL() { puts(""); }
template <typename I, typename... T>
inline void PL(const I x, const T... tail) {
  SP(x);
  if (sizeof...(tail)) putchar(' ');
  PL(tail...);
}
template <typename I>
void _DOING(const char *s, I &&x) {
  cerr << s << " = " << x << endl;
}
template <typename I, typename... T>
void _DOING(const char *s, I &&x, T &&...tail) {
  int c = 0;
  while (*s != ',' || c != 0) {
    if (*s == '(' || *s == '[' || *s == '{') c++;
    if (*s == ')' || *s == ']' || *s == '}') c--;
    cerr << *s++;
  }
  cerr << " = " << x << " , ";
  _DOING(s + 1, tail...);
}
const int INF = 0x3f3f3f3f;
const long long INF64 = 0x3f3f3f3f3f3f3f3fll;
inline int RAND() {
  static int x = 880301;
  return (x = x * 0xdefaced + 1) % 0x7fffffff;
}
const int MAX_N = 200000 + 7;
bool rev_flag;
vector<pair<int, int> > a, b, ans;
vector<pair<int, int> > read() {
  static char s[MAX_N];
  RI(s);
  int n = strlen(s);
  vector<pair<int, int> > v;
  for (int i = 0; i < int(n); i++) {
    if (v.empty() || char(v.back().first + 'a') != s[i])
      v.push_back(make_pair(s[i] - 'a', 1));
    else
      v.back().second++;
  }
  reverse((v).begin(), (v).end());
  return v;
}
void mv(int x, int y) {
  vector<pair<int, int> > c, d;
  int sum_x = 0, sum_y = 0;
  while (x--) {
    c.push_back(a.back());
    sum_x += a.back().second;
    a.pop_back();
  }
  while (y--) {
    d.push_back(b.back());
    sum_y += b.back().second;
    b.pop_back();
  }
  if (rev_flag) swap(sum_x, sum_y);
  ans.push_back(make_pair(sum_x, sum_y));
  while (!c.empty()) {
    pair<int, int> p = c.back();
    c.pop_back();
    if (b.empty() || b.back().first != p.first)
      b.push_back(p);
    else
      b.back().second += p.second;
  }
  while (!d.empty()) {
    pair<int, int> p = d.back();
    d.pop_back();
    if (a.empty() || a.back().first != p.first)
      a.push_back(p);
    else
      a.back().second += p.second;
  }
}
int main() {
  a = read();
  b = read();
  if (((int)a.size()) > ((int)b.size())) {
    swap(a, b);
    rev_flag = 1;
  }
  for (int i = 0; i < int(((int)b.size())); i++) b[i].first ^= a.back().first;
  for (int i = 0; i < int(((int)a.size())); i++) a[i].first ^= a.back().first;
  if (((int)a.size()) == 1) {
    if (b.back().first == 0)
      mv(0, ((int)b.size()) / 4 * 2 + 1);
    else if (((int)b.size()) > 1)
      mv(1, ((int)b.size()) / 4 * 2 + 1);
  } else {
    if (b.back().first == 0) {
      if ((((int)b.size()) - ((int)a.size())) % 4 == 3) mv(1, 2);
      mv(0, (((int)b.size()) - ((int)a.size())) / 4 * 2 + 1);
    } else {
      if ((((int)b.size()) - ((int)a.size())) % 4 == 3)
        mv(1, (((int)b.size()) - ((int)a.size())) / 4 * 2 + 3);
      else
        mv(1, (((int)b.size()) - ((int)a.size())) / 4 * 2 + 1);
    }
  }
  while (((int)a.size()) > 1 || ((int)b.size()) > 1) mv(1, 1);
  PL(((int)ans.size()));
  for (pair<int, int> p : ans) PL(p.first, p.second);
  return 0;
}
