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.
import java.io.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vadim Semenov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream), 1 << 20));
        TaskF solver = new TaskF();
        solver.solve(1, in, out);
        out.close();
    }

    static final class TaskF {
        public void solve(int __, InputReader in, PrintWriter out) {
            String s = in.next();
            String t = in.next();
            int[][] result = solve(s.toCharArray(), t.toCharArray());
            out.println(result.length);
            for (int[] pair : result) {
                out.print(pair[0]);
                out.print(' ');
                out.println(pair[1]);
            }
        }

        private int[][] solve(char[] s, char[] t) {
            int[][] result = solveInternal(s, t);
            int[][] anotherResult = solveInternal(t, s);
            if (anotherResult.length < result.length) {
                result = anotherResult;
                for (int[] pair : result) {
                    ArrayUtils.swap(pair, 0, 1);
                }
            }
            return result;
        }

        private int[][] solveInternal(char[] s, char[] t) {
            List<Integer> sChangings = getChangings(s, 0, s.length, s, 0, 0, 'a');
            List<Integer> tChangings = getChangings(t, 0, t.length, t, 0, 0, 'b');
            int[][] result = solveGreedy(s, 0, s.length, s, 0, 0, t, 0, t.length, t, 0, 0, 0, Integer.MAX_VALUE);
            assert result != null;
            int balance = (sChangings.size() - tChangings.size()) / 2;
            for (int i = 0; i < 3; ++i) {
                for (int j = 0; j < 3; ++j) {
                    int sp = (balance > 0 ? balance : 0) + i;
                    int tp = (balance < 0 ? -balance : 0) + j;
                    if ((sp != 0 && sp >= sChangings.size()) || (tp != 0 && tp >= tChangings.size())) continue;
                    int sSep = sp < sChangings.size() ? sChangings.get(sp) : 0;
                    int tSep = tp < tChangings.size() ? tChangings.get(tp) : 0;
                    int[][] current = solveGreedy(t, 0, tSep, s, sSep, s.length, s, 0, sSep, t, tSep, t.length, 1, result.length);
                    if (current != null) {
                        result = current;
                        current[0][0] = sSep;
                        current[0][1] = tSep;
                    }
                }
            }
            return result;
        }

        private int[][] solveGreedy(char[] s1, int s1from, int s1to,
                                    char[] s2, int s2from, int s2to,
                                    char[] t1, int t1from, int t1to,
                                    char[] t2, int t2from, int t2to,
                                    int offset, int limit) {
            List<Integer> ss = getChangings(s1, s1from, s1to, s2, s2from, s2to, 'a');
            List<Integer> tt = getChangings(t1, t1from, t1to, t2, t2from, t2to, 'b');
            int length = Math.max(ss.size(), tt.size());
            if (offset + length >= limit) {
                return null;
            }
            int[][] result = new int[offset + length][2];
            for (int i = 0; i < length; ++i) {
                result[offset + i][0] = pop(ss);
                result[offset + i][1] = pop(tt);
                List<Integer> tmp = ss;
                ss = tt;
                tt = tmp;
            }
            return result;
        }

        private List<Integer> getChangings(char[] s1, int s1from, int s1to, char[] s2, int s2from, int s2to, char target) {
            List<Integer> changings = new ArrayList<>();
            for (int i = s2to; i-- > s2from; ) {
                char current = s2[i];
                if (current != target) {
                    changings.add(s1to - s1from + i - s2from + 1);
                    target = current;
                }
            }
            for (int i = s1to; i-- > s1from; ) {
                char current = s1[i];
                if (current != target) {
                    changings.add(i - s1from + 1);
                    target = current;
                }
            }
            Collections.reverse(changings);
            return changings;
        }

        private static int pop(List<Integer> stack) {
            return stack.isEmpty() ? 0 : stack.remove(stack.size() - 1);
        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

    }

    static class ArrayUtils {
        private ArrayUtils() {
        }

        public static void swap(int[] array, int i, int j) {
            int tmp = array[i];
            array[i] = array[j];
            array[j] = tmp;
        }

    }
}

