program sinonimiM3;

{$APPTYPE CONSOLE}{$O-}

uses
  SysUtils;
type mas=array[1..10000] of string;
     mas1=array[1..2,1..20000] of integer;
  var s,s1,s2,s3:string;
    i,j,kol,t,n,m,k,k1,k2:integer;
    log:boolean;
    a,b:mas;
    d1,d2:mas1;
procedure perevorot(var s:string;var d:mas1;var k:integer;var a:mas;var n:integer);
 var  c:char;
 begin
  n:=0;
  repeat
  log:=true;
   kol:=0;
    i:=1;
    while (i<=length(s))and(s[i]='1') do inc(i);
    j:=i;
    while (i<=length(s))and(kol<2) do begin
     if s[i]='1'
      then inc(kol);
     if (i<=length(s))and(kol=2)
        then begin
          for t:=j to (i+j)div 2 do begin
           c:=s[t];
           s[t]:=s[i-t+j];
           s[i-t+j]:=c;
          end;
       if i>j then begin
         inc(k);
         d[2,k]:=i;
         d[1,k]:=j;
       end;
          inc(n);
          a[n]:=s;
          j:=i;
          log:=false;
     end;
     inc(i);
    end;
  until log;
 end;
begin
 readln(s);read(s1);
 if s=s1
  then begin writeln('YES');write(0);halt(0)end;
 s2:=s;
 k1:=0;k2:=0;
  perevorot(s,d1,k1,a,n);
  s3:=s1;
  perevorot(s1,d2,k2,b,m);
  if s=s1
   then
    writeln('YES')
   else begin
    write('NO');
    halt(0);
   end;
 writeln(k1+k2);
  for i:=1 to k1 do
   writeln(d1[1,i],' ',d1[2,i]);
  for i:=k2 downto 1 do
   writeln(d2[1,i],' ',d2[2,i]);
 end.


