#include <bits/stdc++.h>
using i8 = char;
using u8 = unsigned char;
using i16 = short int;
using u16 = unsigned short int;
using i32 = long int;
using u32 = unsigned long int;
using i64 = long long int;
using u64 = unsigned long long int;
using f32 = float;
using f64 = double;
using f80 = long double;
const i64 MOD = 1000000007;
inline i64 fast_pow(i64 a, i64 b) {
  i64 ans = 1, base = a;
  while (b) {
    if (b & 1) {
      ans = (ans * base) % MOD;
    }
    base = (base * base) % MOD;
    b >>= 1;
  }
  return ans;
}
using namespace std;
int main(void) {
  string s1;
  string s2;
  cin >> s1 >> s2;
  list<pair<int, char>> l1;
  list<pair<int, char>> l2;
  int len1 = 0;
  int len2 = 0;
  int a = 1;
  char c = s1[0];
  for (u64 i = 1; i < s1.size(); ++i) {
    if (s1[i] == c) {
      ++a;
    } else {
      l1.emplace_back(a, c);
      len1++;
      a = 1;
      c = s1[i];
    }
  }
  l1.emplace_back(a, c);
  len1++;
  a = 1;
  c = s2[0];
  for (u64 i = 1; i < s2.size(); ++i) {
    if (s2[i] == c) {
      ++a;
    } else {
      l2.emplace_back(a, c);
      len2++;
      a = 1;
      c = s2[i];
    }
  }
  l2.emplace_back(a, c);
  len2++;
  bool swapped = false;
  if (len2 > len1) {
    l1.swap(l2);
    int tmp = len1;
    len1 = len2;
    len2 = tmp;
    swapped = !swapped;
  }
  vector<pair<int, int>> v;
  int op = len1 - 1;
  if (l1.front().second == l2.front().second && len1 == len2) {
    op += 1;
  }
  int swap1 = 0;
  int swap2 = 0;
  if (len1 - len2 >= 2) {
    auto it1 = l1.begin();
    for (int sw1 = 1; sw1 <= len1 - 1; ++sw1, ++it1) {
      auto it2 = l2.begin();
      auto tmpit2 = it2;
      auto tmpit1 = it1;
      tmpit2++;
      tmpit1++;
      int tmp1 = len1 - sw1;
      int tmp2 = len2 + sw1;
      if (it1->second == it2->second) {
        tmp2 -= 1;
      }
      int op2 = 1 + max(tmp1, tmp2) - 1;
      if (l1.front().second == tmpit1->second && tmp1 == tmp2) op2 += 1;
      if (op2 < op) {
        op = op2;
        swap1 = sw1;
        swap2 = 0;
      }
      tmp1 = len1 - sw1 + 1;
      tmp2 = len2 - 1 + sw1;
      if (it1->second == tmpit2->second) {
        tmp2 -= 1;
      }
      if (it2->second == tmpit1->second) {
        tmp1 -= 1;
      }
      op2 = 1 + max(tmp1, tmp2) - 1;
      if (l1.front().second == l2.front().second && tmp1 == tmp2) op2 += 1;
      if (op2 < op) {
        op = op2;
        swap1 = sw1;
        swap2 = 1;
      }
    }
  }
  if (swap1 > 0) {
    v.emplace_back(0, 0);
    auto it1 = l1.begin();
    for (i64 i = 0; i < swap1; ++i, ++it1) {
      v[0].first += it1->first;
    }
    if (swap2) v[0].second += l2.begin()->first;
    pair<i64, char> tmp;
    if (swap2) {
      tmp = l2.front();
      l2.pop_front();
    }
    auto first = l1.begin();
    auto last = first;
    advance(last, swap1);
    l2.splice(l2.begin(), l1, first, last);
    auto tmp1 = l2.begin();
    advance(tmp1, swap1 - 1);
    auto tmp2 = tmp1;
    advance(tmp2, 1);
    if (tmp1->second == tmp2->second) {
      tmp1->first += tmp2->first;
      l2.erase(tmp2);
    }
    if (swap2) {
      l1.push_front(tmp);
    }
    tmp1 = l1.begin();
    tmp2 = tmp1;
    advance(tmp2, 1);
    if (tmp1->second == tmp2->second) {
      tmp1->first += tmp2->first;
      l1.erase(tmp2);
    }
    len1 = l1.size();
    len2 = l2.size();
    if (len2 > len1) {
      l1.swap(l2);
      int tmp = len1;
      len1 = len2;
      len2 = tmp;
      swapped = !swapped;
      tmp = v[0].first;
      v[0].first = v[0].second;
      v[0].second = tmp;
    }
  }
  if (l1.front().second == l2.front().second) {
    if (len1 >= len2) {
      v.emplace_back(l1.front().first, 0);
      l2.front().first += l1.front().first;
      l1.pop_front();
    } else {
      v.emplace_back(0, l2.front().first);
      l1.front().first += l2.front().first;
      l2.pop_front();
    }
  }
  while (1) {
    int a1 = l1.front().first;
    int a2 = l2.front().first;
    char c1 = l1.front().second;
    char c2 = l2.front().second;
    l1.pop_front();
    l2.pop_front();
    if (l1.empty() && l2.empty()) break;
    v.emplace_back(a1, a2);
    if (!l1.empty()) {
      l1.front().first += a2;
    } else {
      l1.emplace_front(a2, c2);
    }
    if (!l2.empty()) {
      l2.front().first += a1;
    } else {
      l2.emplace_front(a1, c1);
    }
  }
  cout << v.size() << "\n";
  for (auto it : v) {
    if (swapped) {
      cout << it.second << " " << it.first << "\n";
    } else {
      cout << it.first << " " << it.second << "\n";
    }
  }
  return 0;
}

### Prompt

In Cpp, your task is to solve the following 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.

### Response

```cpp
#include <bits/stdc++.h>
using i8 = char;
using u8 = unsigned char;
using i16 = short int;
using u16 = unsigned short int;
using i32 = long int;
using u32 = unsigned long int;
using i64 = long long int;
using u64 = unsigned long long int;
using f32 = float;
using f64 = double;
using f80 = long double;
const i64 MOD = 1000000007;
inline i64 fast_pow(i64 a, i64 b) {
  i64 ans = 1, base = a;
  while (b) {
    if (b & 1) {
      ans = (ans * base) % MOD;
    }
    base = (base * base) % MOD;
    b >>= 1;
  }
  return ans;
}
using namespace std;
int main(void) {
  string s1;
  string s2;
  cin >> s1 >> s2;
  list<pair<int, char>> l1;
  list<pair<int, char>> l2;
  int len1 = 0;
  int len2 = 0;
  int a = 1;
  char c = s1[0];
  for (u64 i = 1; i < s1.size(); ++i) {
    if (s1[i] == c) {
      ++a;
    } else {
      l1.emplace_back(a, c);
      len1++;
      a = 1;
      c = s1[i];
    }
  }
  l1.emplace_back(a, c);
  len1++;
  a = 1;
  c = s2[0];
  for (u64 i = 1; i < s2.size(); ++i) {
    if (s2[i] == c) {
      ++a;
    } else {
      l2.emplace_back(a, c);
      len2++;
      a = 1;
      c = s2[i];
    }
  }
  l2.emplace_back(a, c);
  len2++;
  bool swapped = false;
  if (len2 > len1) {
    l1.swap(l2);
    int tmp = len1;
    len1 = len2;
    len2 = tmp;
    swapped = !swapped;
  }
  vector<pair<int, int>> v;
  int op = len1 - 1;
  if (l1.front().second == l2.front().second && len1 == len2) {
    op += 1;
  }
  int swap1 = 0;
  int swap2 = 0;
  if (len1 - len2 >= 2) {
    auto it1 = l1.begin();
    for (int sw1 = 1; sw1 <= len1 - 1; ++sw1, ++it1) {
      auto it2 = l2.begin();
      auto tmpit2 = it2;
      auto tmpit1 = it1;
      tmpit2++;
      tmpit1++;
      int tmp1 = len1 - sw1;
      int tmp2 = len2 + sw1;
      if (it1->second == it2->second) {
        tmp2 -= 1;
      }
      int op2 = 1 + max(tmp1, tmp2) - 1;
      if (l1.front().second == tmpit1->second && tmp1 == tmp2) op2 += 1;
      if (op2 < op) {
        op = op2;
        swap1 = sw1;
        swap2 = 0;
      }
      tmp1 = len1 - sw1 + 1;
      tmp2 = len2 - 1 + sw1;
      if (it1->second == tmpit2->second) {
        tmp2 -= 1;
      }
      if (it2->second == tmpit1->second) {
        tmp1 -= 1;
      }
      op2 = 1 + max(tmp1, tmp2) - 1;
      if (l1.front().second == l2.front().second && tmp1 == tmp2) op2 += 1;
      if (op2 < op) {
        op = op2;
        swap1 = sw1;
        swap2 = 1;
      }
    }
  }
  if (swap1 > 0) {
    v.emplace_back(0, 0);
    auto it1 = l1.begin();
    for (i64 i = 0; i < swap1; ++i, ++it1) {
      v[0].first += it1->first;
    }
    if (swap2) v[0].second += l2.begin()->first;
    pair<i64, char> tmp;
    if (swap2) {
      tmp = l2.front();
      l2.pop_front();
    }
    auto first = l1.begin();
    auto last = first;
    advance(last, swap1);
    l2.splice(l2.begin(), l1, first, last);
    auto tmp1 = l2.begin();
    advance(tmp1, swap1 - 1);
    auto tmp2 = tmp1;
    advance(tmp2, 1);
    if (tmp1->second == tmp2->second) {
      tmp1->first += tmp2->first;
      l2.erase(tmp2);
    }
    if (swap2) {
      l1.push_front(tmp);
    }
    tmp1 = l1.begin();
    tmp2 = tmp1;
    advance(tmp2, 1);
    if (tmp1->second == tmp2->second) {
      tmp1->first += tmp2->first;
      l1.erase(tmp2);
    }
    len1 = l1.size();
    len2 = l2.size();
    if (len2 > len1) {
      l1.swap(l2);
      int tmp = len1;
      len1 = len2;
      len2 = tmp;
      swapped = !swapped;
      tmp = v[0].first;
      v[0].first = v[0].second;
      v[0].second = tmp;
    }
  }
  if (l1.front().second == l2.front().second) {
    if (len1 >= len2) {
      v.emplace_back(l1.front().first, 0);
      l2.front().first += l1.front().first;
      l1.pop_front();
    } else {
      v.emplace_back(0, l2.front().first);
      l1.front().first += l2.front().first;
      l2.pop_front();
    }
  }
  while (1) {
    int a1 = l1.front().first;
    int a2 = l2.front().first;
    char c1 = l1.front().second;
    char c2 = l2.front().second;
    l1.pop_front();
    l2.pop_front();
    if (l1.empty() && l2.empty()) break;
    v.emplace_back(a1, a2);
    if (!l1.empty()) {
      l1.front().first += a2;
    } else {
      l1.emplace_front(a2, c2);
    }
    if (!l2.empty()) {
      l2.front().first += a1;
    } else {
      l2.emplace_front(a1, c1);
    }
  }
  cout << v.size() << "\n";
  for (auto it : v) {
    if (swapped) {
      cout << it.second << " " << it.first << "\n";
    } else {
      cout << it.first << " " << it.second << "\n";
    }
  }
  return 0;
}

```