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.




If Cmd (0) < 2 Then Print "Usage: fasta <fasta file>" : End
If Set(a, Open (Cmd(2), "r")) < 0 Then Print "Cannot open \q";Cmd(2);"\q" : End
 
Do While Read (a)                      ' while there are lines to process
  t = Tok (0)                          ' get a lime
 
  If Peek(t, 0) = Ord(">") Then        ' if it's a marker
    Print Show (Chop(t, 1)); ": "; Show (FUNC(_Payload(a)))
    Continue                           ' get the payload and print it
  EndIf
 
  Print "Out of sequence" : Break      ' this should never happen
Loop
 
Close a                                ' close the file
End                                    ' and end the program
 
_Payload                               ' get the payload
  Param (1)
  Local (4)
 
  b@ = Dup("")                         ' start with an empty string
 
  Do
    c@ = Mark(a@)                      ' mark its position
  While Read (a@)                      ' now read a line
    d@ = Tok (0)                       ' get the line
    If Peek (d@, 0) = Ord(">") Then e@ = Head(a@, c@) : Break
    b@ = Join (b@, d@)                 ' marker? reset position and exit
  Loop                                 ' if not add the line to current string
 
Return (b@)                            ' return the string