Pulling the identifier list out of a FASTA file is how you check which sequences a
file actually contains before committing to an hour-long alignment run. It is also the first step in
cross-referencing two datasets — extract the IDs from each, then use comm or sort to find what they
share. Chaining a filter into a transformation is the fundamental Unix pattern.
Statement
FASTA-formatted text arrives on standard input.
For every header line, print the identifier: the header text with the leading > removed, truncated at
the first space if a description follows.
Print one identifier per line, in the order the records appear.
Input — read from standard input
Variable
Type
Description
fasta
line 1..n
str
FASTA-formatted text on standard input
1 <= records <= 1000
These variables are already read for you in the starter code on the right.
Output
str
one identifier per line, in record order, with the leading > and any description removed
Sample Cases
Sample 1
Input
>seq1 first sequence
ACGT
>seq2 second one
TTTT
Expected Output
seq1
seq2
Both descriptions are dropped, leaving just the identifiers.
Sample 2
Input
>plain
ACGT
Expected Output
plain
A header with no description at all.
Submit also runs your code against 3 hidden test cases.
Hidden inputs are never shown — if one fails you'll get its number and a description of the
mismatch, not the data.
Constraints
Identifiers contain no spaces
Any text after the first space in a header is a description and must be dropped