The DNA sequence of an organism is not just a string of genes. In order to express a gene, it first must be transcribed to RNA, and then translated into a protein. One step in the transcription process is splicing. Genes are not contiguous within the genome. Instead, they are broken up into segments, called exons, which are interspersed with non-coding introns. To produce the final sequence, introns are removed and exons are joined back together in the same order. Given the RNA alphabet A, C, G and U, all introns start with the sequence GUGU and end with AGAG. Any substring that doesn't have this property is an exon. Write a program that behaves like a spliceosome. Given an RNA sequence, it should return the corresponding gene with the introns removed. Notes Every intron opened will be closed. An intron is opened by GUGU and is closed by the first subsequent occurrence of AGAG. GUGU may appear inside introns, and AGAG may appear inside exons. Example Input strand: AGCGUGUGAGAGCUCCGA Output is AGCCUCCGA
The DNA sequence of an organism is not just a string of genes. In order to express a gene, it first must be transcribed to RNA, and then translated into a protein.
One step in the transcription process is splicing. Genes are not contiguous within the genome. Instead, they are broken up into segments, called exons, which are interspersed with non-coding introns. To produce the final sequence, introns are removed and exons are joined back together in the same order.
Given the RNA alphabet A, C, G and U, all introns start with the sequence GUGU and end with AGAG. Any substring that doesn't have this property is an exon.
Write a program that behaves like a spliceosome. Given an RNA sequence, it should return the corresponding gene with the introns removed.
Notes
-
Every intron opened will be closed.
-
An intron is opened by GUGU and is closed by the first subsequent occurrence of AGAG.
-
GUGU may appear inside introns, and AGAG may appear inside exons.
Example
Unlock instant AI solutions
Tap the button
to generate a solution