#K79357. DNA Sequence Analyzer
DNA Sequence Analyzer
DNA Sequence Analyzer
In this problem, you are given a DNA sequence consisting of characters from the set ({A, C, G, T}). Your task is to analyze the sequence and perform three operations:
- Check if the sequence is valid (i.e. every character in the sequence is one of A, C, G, or T).
- Compute the reverse complement of the sequence. The reverse complement is obtained by reversing the sequence and then replacing each nucleotide with its complement: (A \leftrightarrow T) and (C \leftrightarrow G).
- Count the occurrences of each nucleotide (A, C, G, T) in the sequence.
If the DNA sequence is invalid, output should indicate an error for the reverse complement and nucleotide count operations.
inputFormat
Input is read from standard input (stdin). It consists of a single line containing the DNA sequence (which may be empty).
outputFormat
Output should be written to standard output (stdout) as three lines:
- The first line prints either 'True' if the sequence is valid or 'False' otherwise.
- The second line prints the reverse complement of the sequence if it is valid, or 'Invalid' if it is not.
- The third line prints four space-separated integers representing the nucleotide counts for A, C, G, and T respectively if the sequence is valid, or 'Invalid' if it is not.## sample
AGCTTAGC
True
GCTAAGCT
2 2 2 2
</p>