In bioinformatics, long character strings are often encoded in a format called FASTA.

A FASTA file can contain several strings, each identified by a name marked by a > (greater than) character at the beginning of the line.



Task

Write a program that reads a FASTA file such as:

>Rosetta_Example_1
THERECANBENOSPACE
>Rosetta_Example_2
THERECANBESEVERAL
LINESBUTTHEYALLMUST
BECONCATENATED


Output:
Rosetta_Example_1: THERECANBENOSPACE
Rosetta_Example_2: THERECANBESEVERALLINESBUTTHEYALLMUSTBECONCATENATED

Note that a high-quality implementation will not hold the entire file in memory at once; real FASTA files can be multiple gigabytes in size.




 
program FASTA_Format;
// FPC 3.0.2
var InF,
    OutF: Text;
    ch: char;
    First: Boolean=True;
    InDef: Boolean=False;
 
begin
  Assign(InF,'');
  Reset(InF);
  Assign(OutF,'');
  Rewrite(OutF);
  While Not Eof(InF) do
  begin
    Read(InF,ch);
    Case Ch of
      '>': begin
            if Not(First) then
              Write(OutF,#13#10)
            else
              First:=False;
            InDef:=true;
          end;
      #13: Begin
               if InDef then
               begin
                 InDef:=false;
                 Write(OutF,': ');
               end;
               Ch:=#0;
             end;
      #10: ch:=#0;
      else Write(OutF,Ch);
    end;
  end;
  Close(OutF);
  Close(InF);
end.
 