func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class TH>   void _dbg(const char *sdbg, TH h) {     cerr << sdbg <<   =   << h << endl;   }   template <class TH, class... TA>   void _dbg(const char *sdbg, TH h, TA... a) {     while (*sdbg !=  , ) cerr << *sdbg++;     cerr <<   =   << h <<  ,  ;     _dbg(sdbg + 1, a...);   }   const int maxn = (1e6) + 7;   const int maxk = 20;   const int inf = (1e9) + 7;   const long long LLinf = (1e18) + 7;   const long double eps = 1e-9;   const long long mod = 1e9 + 7;   struct lit {     bool stan = 0;     int dlu = 1;     lit() {}     lit(int a, int b) {       stan = a;       dlu = b;     }   };   lit merge(lit a, lit b) {     assert(a.stan == b.stan);     return lit(a.stan, a.dlu + b.dlu);   }   vector<lit> a, b, A, B;   vector<pair<int, int> > odp;   void normuj(vector<lit> &a) {     vector<lit> b;     for (int i = 0; i < ((int)(a).size()); i++)       if (((int)(b).size()) > 0 && b.back().stan == a[i].stan)         b.back() = merge(b.back(), a[i]);       else         b.push_back(a[i]);     a = b;   }   vector<pair<int, int> > elo() {     odp.clear();     int ile = 0;     bool f = 0;     ile = ((int)(a).size()) + ((int)(b).size());     if ((((int)(a).size()) > 2 || ((int)(b).size()) > 2) &&         abs(((int)(a).size()) - ((int)(b).size())) > 2) {       if (((int)(a).size()) < ((int)(b).size())) f = 1, swap(a, b);       int le = ile / 2 - 1;       while (le + 1 < ((int)(a).size()) && a[le].stan == b.back().stan &&              a.back().stan != b.back().stan)         le++;       if (a.back().stan == b.back().stan) {         le = ile / 2 - 1;         while (le + 1 < ((int)(a).size()) && a[le].stan != b.back().stan) le++;       }       int cnt = 0;       vector<lit> xd, xd2;       for (int i = 0; i < le; i++) xd.push_back(a[i]);       for (int i = 0; i < ((int)(b).size()) - 1; i++) xd2.push_back(b[i]);       if (a.back().stan == b.back().stan) xd2.push_back(b.back());       int dlu = 0;       for (int i = le; i < ((int)(a).size()); i++)         xd2.push_back(a[i]), dlu += a[i].dlu;       if (a.back().stan != b.back().stan)         odp.push_back({dlu, b.back().dlu}), xd.push_back(b.back());       else         odp.push_back({dlu, 0});       b = xd2;       a = xd;       normuj(a);       normuj(b);     };     while (((int)(a).size()) > 1 && ((int)(b).size()) > 1) {       if (((int)(a).size()) == 2 && ((int)(b).size()) == 2) {         if (a.back().stan == b.back().stan) {           odp.push_back({a.back().dlu, 0});           odp.push_back({a[0].dlu, a.back().dlu + b.back().dlu});         } else           odp.push_back({a.back().dlu, b.back().dlu});         if (f)           for (auto &s : odp) swap(s.first, s.second);         return odp;       }       if (a.back().stan == b.back().stan) {         if (((int)(a).size()) >= ((int)(b).size())) {           pair<lit, lit> xd = {a[((int)(a).size()) - 2], a.back()};           odp.push_back({xd.first.dlu + xd.second.dlu, b.back().dlu});           a.pop_back();           a.pop_back();           lit xdxd = b.back();           b.pop_back();           a.back() = merge(a.back(), xdxd);           b.back() = merge(xd.first, b.back());           b.push_back(xd.second);         } else {           pair<lit, lit> xd = {b[((int)(b).size()) - 2], b.back()};           odp.push_back({a.back().dlu, xd.first.dlu + xd.second.dlu});           b.pop_back();           b.pop_back();           lit xdxd = a.back();           a.pop_back();           b.back() = merge(b.back(), xdxd);           a.back() = merge(xd.first, a.back());           a.push_back(xd.second);         }       } else {         odp.push_back({a.back().dlu, b.back().dlu});         lit xd = a.back();         lit xd2 = b.back();         a.pop_back();         b.pop_back();         b.back() = merge(b.back(), xd);         a.back() = merge(a.back(), xd2);       }     };     if (((int)(a).size()) == 3 && ((int)(b).size()) == 1) {       if (a.back().stan == b.back().stan) {         odp.push_back({a.back().dlu, 0});         odp.push_back(             {a[((int)(a).size()) - 2].dlu, a.back().dlu + b.back().dlu});       } else {         odp.push_back({a.back().dlu, b.back().dlu});         odp.push_back(             {a[((int)(a).size()) - 2].dlu + b.back().dlu, a.back().dlu});       }     }     if (((int)(a).size()) == 1 && ((int)(b).size()) == 3) {       if (b.back().stan == a.back().stan) {         odp.push_back({0, b.back().dlu});         odp.push_back(             {b.back().dlu + a.back().dlu, b[((int)(b).size()) - 2].dlu});       } else {         odp.push_back({a.back().dlu, b.back().dlu});         odp.push_back(             {b.back().dlu, b[((int)(b).size()) - 2].dlu + a.back().dlu});       }     }     if (((int)(a).size()) == 2 && ((int)(b).size()) == 1) {       if (a.back().stan == b.back().stan)         odp.push_back({a.back().dlu, 0});       else         odp.push_back({a.back().dlu, b.back().dlu});     }     if (((int)(b).size()) == 2 && ((int)(a).size()) == 1) {       if (a.back().stan == b.back().stan)         odp.push_back({0, b.back().dlu});       else         odp.push_back({a.back().dlu, b.back().dlu});     }     if (f)       for (auto &s : odp) swap(s.first, s.second);     return odp;   }   vector<pair<int, int> > eloelo() {     bool f = 0;     int ile = 0;     odp.clear();     ile = ((int)(a).size()) + ((int)(b).size());     if ((((int)(a).size()) > 2 || ((int)(b).size()) > 2) &&         abs(((int)(a).size()) - ((int)(b).size())) > 2) {       if (((int)(a).size()) < ((int)(b).size())) f = 1, swap(a, b);       int le = ile / 2 - 1;       while (le + 1 < ((int)(a).size()) && a[le].stan == b.back().stan) le++;       int cnt = 0;       vector<lit> xd, xd2;       for (int i = 0; i < le; i++) xd.push_back(a[i]);       for (int i = 0; i < ((int)(b).size()) - 1; i++) xd2.push_back(b[i]);       int dlu = 0;       for (int i = le; i < ((int)(a).size()); i++)         xd2.push_back(a[i]), dlu += a[i].dlu;       odp.push_back({dlu, b.back().dlu});       xd.push_back(b.back());       b = xd2;       a = xd;       normuj(a);       normuj(b);     }     while (((int)(a).size()) > 1 && ((int)(b).size()) > 1) {       if (((int)(a).size()) == 2 && ((int)(b).size()) == 2) {         if (a.back().stan == b.back().stan) {           odp.push_back({a.back().dlu, 0});           odp.push_back({a[0].dlu, a.back().dlu + b.back().dlu});         } else           odp.push_back({a.back().dlu, b.back().dlu});         if (f)           for (auto &s : odp) swap(s.first, s.second);         return odp;       }       if (a.back().stan == b.back().stan) {         if (((int)(a).size()) >= ((int)(b).size())) {           pair<lit, lit> xd = {a[((int)(a).size()) - 2], a.back()};           odp.push_back({xd.first.dlu + xd.second.dlu, b.back().dlu});           a.pop_back();           a.pop_back();           lit xdxd = b.back();           b.pop_back();           a.back() = merge(a.back(), xdxd);           b.back() = merge(xd.first, b.back());           b.push_back(xd.second);         } else {           pair<lit, lit> xd = {b[((int)(b).size()) - 2], b.back()};           odp.push_back({a.back().dlu, xd.first.dlu + xd.second.dlu});           b.pop_back();           b.pop_back();           lit xdxd = a.back();           a.pop_back();           b.back() = merge(b.back(), xdxd);           a.back() = merge(xd.first, a.back());           a.push_back(xd.second);         }       } else {         odp.push_back({a.back().dlu, b.back().dlu});         lit xd = a.back();         lit xd2 = b.back();         a.pop_back();         b.pop_back();         b.back() = merge(b.back(), xd);         a.back() = merge(a.back(), xd2);       }     };     if (((int)(a).size()) == 3 && ((int)(b).size()) == 1) {       if (a.back().stan == b.back().stan) {         odp.push_back({a.back().dlu, 0});         odp.push_back(             {a[((int)(a).size()) - 2].dlu, a.back().dlu + b.back().dlu});       } else {         odp.push_back({a.back().dlu, b.back().dlu});         odp.push_back(             {a[((int)(a).size()) - 2].dlu + b.back().dlu, a.back().dlu});       }     }     if (((int)(a).size()) == 1 && ((int)(b).size()) == 3) {       if (b.back().stan == a.back().stan) {         odp.push_back({0, b.back().dlu});         odp.push_back(             {b.back().dlu + a.back().dlu, b[((int)(b).size()) - 2].dlu});       } else {         odp.push_back({a.back().dlu, b.back().dlu});         odp.push_back(             {b.back().dlu, b[((int)(b).size()) - 2].dlu + a.back().dlu});       }     }     if (((int)(a).size()) == 2 && ((int)(b).size()) == 1) {       if (a.back().stan == b.back().stan)         odp.push_back({a.back().dlu, 0});       else         odp.push_back({a.back().dlu, b.back().dlu});     }     if (((int)(b).size()) == 2 && ((int)(a).size()) == 1) {       if (a.back().stan == b.back().stan)         odp.push_back({0, b.back().dlu});       else         odp.push_back({a.back().dlu, b.back().dlu});     }     if (f)       for (auto &s : odp) swap(s.first, s.second);     return odp;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     string s;     cin >> s;     char poprz = 0;     int ile = 0;     for (auto v : s) {       if (v == poprz)         ile++;       else {         if (ile > 0) a.push_back(lit(poprz -  a , ile));         poprz = v;         ile = 1;       }     }     a.push_back(lit(poprz -  a , ile));     cin >> s;     ile = 0;     poprz =  a ;     for (auto v : s) {       if (v == poprz)         ile++;       else {         if (ile > 0) b.push_back(lit(poprz -  a , ile));         poprz = v;         ile = 1;       }     }     b.push_back(lit(poprz -  a , ile));     reverse(a.begin(), a.end());     reverse(b.begin(), b.end());     A = a;     B = b;     vector<pair<int, int> > x = elo();     a = A;     b = B;     vector<pair<int, int> > y = eloelo();     cout << min(((int)(x).size()), ((int)(y).size())) <<   n ;     if (((int)(x).size()) < ((int)(y).size()))       for (auto s : x) cout << s.first <<     << s.second <<   n ;     else       for (auto s : y) cout << s.first <<     << s.second <<   n ;     return 0;   }   