program ProjectI;

uses
  SysUtils;

var
  fin, fout: TextFile;
  res, i: Byte;
  ch: char;
  str: string;

function DoSomething(i: Byte): string;
var
  k: Byte;
begin
  if i = 0
  then
    begin
      result := '{}';
      exit;
    end;

  result := '{' + DoSomething(0);

  for k:=1 to i-1 do
    result := result + ',' + DoSomething(k);

  result := result + '}';
end;

begin
  AssignFile(fin, 'input.txt');
  reset(fin);

  AssignFile(fout, 'output.txt');
  rewrite(fout);

  i := 0;
  while not(eoln(fin)) do
    begin
      read(fin, ch);

      if ch = '{'
      then
        i := i + 1;
    end;

  readln(fin);

  res := round(ln(i)/ln(2));

  i := 0;
  while not(eof(fin)) do
    begin
      read(fin, ch);

      if ch = '{'
      then
        i := i + 1;
    end;

  res := res + round(ln(i)/ln(2));

  {for res := 0 to 3 do
  begin}
  str := DoSomething(res);

  write(fout, str);
  {end;}

  CloseFile(fin);
  CloseFile(fout);
end.

