Gene Coding Regions (1)

In a DNA sequence, start codons and stop codons delimit a coding region
of a gene –a.k.a. coding DNA sequence (CDS)–, which is the part of a
gene that is translated into a protein.

Any CDS starts with the universal start codon ATG and ends with the
first occurrence of a stop codon (either TAA, TAG, or TGA).

Write a program that, given a DNA sequence, writes the gene coding
regions it contains.

Input

A sequence of codons (triplets of A, T, C, G), which may contain zero or
more CDS delimited by start/stop codons.

The input sequence may appear in several lines, with one or more
whitespaces or newlines between one codon and the next.

Assume that the CDS in the sequence –if any– are well-formed. That is,
if a start codon appears, an end codon will appear later before the
sequence ends or the start codon appears again. No end codon will appear
if no start codon has previously appeared.

Output

A line with the codons formed by each CDS found in the input DNA
sequence.

If no CDS is found in the sequence, the output is "No CDS found".

Problem information

Author: Lluís Padró

Generation: 2026-01-25T17:33:44.557Z

© Jutge.org, 2006–2026.
https://jutge.org
