program main;
const alpha=['А'..'Я', 'а'..'п', 'р'..'я'];
const chars=['.', ',', '-', ':', ';', '?', 
            '!', '"'];
type SoC=set of char;
var i: Integer;
    w: string;
    c: char;
    first: SoC;

{Получение множества букв заданного слова}
procedure GetChars(s: string; var m: SoC);
var i: Integer;
begin
  for i:=1 to length(s) do
    if s[i] in alpha then
      include(m, s[i]);
end;

begin
  assign(input, 'input.txt');
  reset(input);
  assign(output, 'output.txt');
  rewrite(output);
  
  while not eof(input) do begin
    read(input, c); {Читаем один символ}
    if c in alpha then begin
      w:='';
      {Составляем слово}
      while (c in alpha) and (not eof(input)) do begin
        w:=w+c;
        write(output, c);
        read(input, c);
      end;
    end
    else
      write(output, c); {Записываем неалфавитный символ}
    {if w<>'' then
      write(output, '(', w, ') '); {Выводим слово в скобочках}
  end;
  
  close(input);
  close(output);
end.