#K79357. DNA Sequence Analyzer

    ID: 35290 Type: Default 1000ms 256MiB

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:

  1. Check if the sequence is valid (i.e. every character in the sequence is one of A, C, G, or T).
  2. 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).
  3. 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:

  1. The first line prints either 'True' if the sequence is valid or 'False' otherwise.
  2. The second line prints the reverse complement of the sequence if it is valid, or 'Invalid' if it is not.
  3. 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>