var s:string;
    a:array [1..36] of string;
    ac:integer;

procedure swap (x, y:integer);
var t:char;
begin
  t:=s[x]; s[x]:=s[y]; s[y]:=t;
end;

procedure add;
begin
  inc (ac); a[ac]:=s;
end;

procedure alldig;
begin
  add; swap (3, 4);
  add; swap (2, 3);
  add; swap (3, 4);
  add; swap (2, 3);
  add; swap (3, 4);
  add; swap (2, 3);
end;

procedure allnum;
begin
  alldig; swap (5, 6);
  alldig; swap (1, 5);
  alldig; swap (5, 6);
  alldig; swap (1, 5);
  alldig; swap (5, 6);
  alldig; swap (1, 5);
end;

var t:string;
    i, j, p:integer;

begin
  reset (input, 'numbers.in'); rewrite (output, 'numbers.out');
  readln (s);
  allnum;
  for i:=1 to ac do
    for j:=ac downto i+1 do
      if a[j]<a[i] then begin 
        t:=a[j]; a[j]:=a[i]; a[i]:=t;
      end;
  p:=1;
  for i:=2 to ac do if a[i]>a[i-1] then begin inc (p); a[p]:=a[i] end;
  writeln (p);
  for i:=1 to p do writeln (a[i]);
end.