program ProjectI;

uses
  SysUtils;

var
  fin, fout: TextFile;
  res: Byte;
  k: Longword;
  ch: char;

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

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

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

  result := result + '}';
end;

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

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

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

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

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

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

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

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

  write(fout, DoSomething(res));

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

