import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Scanner;

public class Start {

	private String s1;
	private String s2;

	private void init() {
		Scanner sc = new Scanner(System.in);
		s1 = sc.nextLine();
		s2 = sc.nextLine();
	}

	public enum Type {
		ONE, ZERO;
	}

	private static class Element {
		public Element(Type type, int count) {
			this.type = type;
			this.count = count;
		}

		Type type;
		int count;
	}

	private void solve() {
		LinkedList<Element> a = new LinkedList<Element>();
		List<Swap> swaps1 = toS0(s1, a);
		LinkedList<Element> b = new LinkedList<Element>();
		List<Swap> swaps2 = toS0(s2, b);

		/*for (Element e : a) {
			System.out.print(e.type + "(" + e.count + "),");
		}
		System.out.println();

		for (Element e : b) {
			System.out.print(e.type + "(" + e.count + "),");
		}
		System.out.println();
*/
		ListIterator<Element> itr1 = a.listIterator();
		ListIterator<Element> itr2 = b.listIterator();

		while (itr1.hasNext() && itr2.hasNext()) {
			Element e1 = itr1.next();
			Element e2 = itr2.next();
			if (e1.type != e2.type || e1.count != e2.count) {
				System.out.println("NO");
				return;
			}
		}
		if (itr1.hasNext() || itr2.hasNext()) {
			System.out.println("NO");
			return;
		}
		System.out.println("YES");
		System.out.println(swaps1.size() + swaps2.size());


		for (Swap swap : swaps1) {
			System.out.println(swap.i + " " + swap.j);
		}
		Collections.reverse(swaps2);
		for (Swap swap : swaps2) {
			System.out.println(swap.i + " " + swap.j);
		}

	}

	private List<Swap> toS0(String s1, LinkedList<Element> a) {
		int i = 0;
		while (i < s1.length()) {
			int d = 0;
			while (i < s1.length() && s1.charAt(i) == '0') {
				d++;
				i++;
			}
			if (d != 0) {
				a.add(new Element(Type.ZERO, d));
			}
			d = 0;
			while (i < s1.length() && s1.charAt(i) == '1') {
				d++;
				i++;
			}
			if (d != 0) {
				a.add(new Element(Type.ONE, d));
			}
		}
		
		List<Swap> swaps1 = new ArrayList<Swap>();
		ListIterator<Element> itr = a.listIterator();
		int j = 0;
		while (itr.hasNext()) {
			Element e0 = itr.next();
			int k = e0.count;
			if (e0.type == Type.ZERO) {
				if (itr.hasNext()) {
					itr.remove();
					Element e1 = itr.next();
					itr.remove();
					if (e1.count >= 2) {
						Element e2 = new Element(Type.ONE, e1.count - e1.count % 2);
						itr.add(e2);
						k = k + e2.count;
						if (e1.count % 2 > 0) {
							itr.add(e0);
							itr.add(new Element(Type.ONE, 1));
							swaps1.add(new Swap(j + 1, j + k));
							itr.previous();
							itr.previous();
							itr.previous();
						} else {
							swaps1.add(new Swap(j + 1, j + k));
							if (itr.hasNext()) {
								Element e3 = itr.next();
								itr.remove();
								itr.add(new Element(Type.ZERO, e0.count + e3.count));
								itr.previous();
							}else{
								itr.add(e0);
								itr.previous();
							}
							itr.previous();
						}
					} else {
						if (itr.hasNext()) {
							Element e2 = itr.next();
							itr.remove();
							k++;
							k = k + e2.count;
							if (itr.hasNext()) {
								Element e3 = itr.next();
								itr.remove();
								k = k + e3.count;
								if (e3.count % 2 > 0) {
									itr.add(e3);
									itr.add(e2);
									itr.add(e1);
									swaps1.add(new Swap(j + 1, j + k));
									if (itr.hasNext()) {
										Element e4 = itr.next();
										itr.remove();
										itr.add(new Element(Type.ZERO, e0.count + e4.count));
									} else {
										itr.add(e0);
									}
									itr.previous();
									itr.previous();
									itr.previous();
									itr.previous();
								} else {
									swaps1.add(new Swap(j + 1, j + k - 1));
									itr.add(new Element(Type.ONE, e3.count - 1));
									itr.add(e2);
									itr.add(e1);
									itr.add(e0);
									itr.add(new Element(Type.ONE, 1));
									itr.previous();
									itr.previous();
									itr.previous();
									itr.previous();
									itr.previous();
								}
							} else {
								itr.add(e0);
								itr.add(e1);
								itr.add(e2);
							}
						} else {
							itr.add(e0);
							itr.add(e1);
						}

					}
				}
			} else {
				/*if (itr.hasPrevious()) {
					itr.previous();
					Element d0 = itr.next();
					if (itr.hasNext()) {
						itr.remove();
						Element d1 = itr.next();
						itr.remove();
						if (d0.type == d1.type) {
							itr.add(new Element(d1.type, d0.count + d1.count));
							itr.previous();
						} else {
							itr.add(d0);
							itr.add(d1);
							itr.previous();
						}
					}
				}*/
				j = e0.count + j;
			}
			/*int zero = 0;
			for (Element e : a){
				if (e.type == Type.ZERO){
					zero = zero + 1;
				}
			}
			System.out.println(zero);*/
		}

		// for (Swap swap : swaps1) {
		// System.out.println(swap.i + " " + swap.j);
		// }

		ListIterator<Element> itr1 = a.listIterator();
		while (itr1.hasNext()) {
			Element e = itr1.next();
			if (itr1.hasNext()) {
				itr1.remove();
				Element e1 = itr1.next();
				itr1.remove();
				if (e.type == e1.type) {
					itr1.add(new Element(e.type, e.count + e1.count));
					itr1.previous();
				} else {
					itr1.add(e);
					itr1.add(e1);
					itr1.previous();
				}
			}
		}

		return swaps1;
	}

	private static class Swap {
		public Swap(int i, int j) {
			this.i = i;
			this.j = j;
		}

		int i;
		int j;
	}

	public static void main(String[] args) {
		Start start = new Start();
		start.init();
		start.solve();
	}
}
