Programming Question #: pairing the base chain
Source: POJ (Coursera statement: The exercises completed on POJ will not count against the final results of Coursera. )
Note: Total time limit: 1000ms memory limit: 65536kB
Describe
DNA (DNA) is made up of two complementary base chains that are combined in a two-helix manner. There were 4 bases of DNA, namely, adenosine (A), guanine (G), Thymic pyrimidine (T) and cytosine (C). We know that in the corresponding position of the two complementary base chains, the adenoma is always paired with the cytosine, and guanine is always paired with cytosine. Your task is to give the base sequence of the corresponding complementary chain according to the base sequence of a single strand.
Input
The first line is a positive integer n, which indicates the base chain of a total of n required solutions.
The following is a total of n rows, each with a string representing a base chain. This string contains only uppercase A, T, G, and C, respectively, indicating the adenoma, thymus, guanine, and cytosine. The length of each base chain is no more than 255.
Output
A total of n rows, each of which contains only uppercase A, T, G, and C strings. The base chain which is complementary to each base chain of the input is respectively.
Sample input
5ATATGGATGGTGTTTGGCTCTGTCTCCGGTTGATTATATCTTGCGCTCTTGATTCGCATATTCTGCGTTTCGTTGCAATTAACGCACAACCTAGACTT
Sample output
Tatacctaccacaaaccgagacagaggccaactaatatagaacgcgagaactaagcgtataagacgcaaagcaacgttaattgcgtgttggatctgaa
1#include <stdio.h>2#include <string.h>3 using namespacestd;4 5 intMain () {6 intn, I;7scanf"%d", &n);8 Chara[ the];9 GetChar ();Ten while(n--) { One gets (a); A intLen =strlen (a); - for(i=0; i<len;i++) { - Switch(A[i]) { the Case 'A': -printf"T"); - Break; - Case 'T' : +printf"A"); - Break; + Case 'G' : Aprintf"C"); at Break; - Case 'C' : -printf"G"); - Break; - } - } inprintf"\ n"); - } to return 0; +}
POJ C Programming Advanced Programming Problem # #: Pairing base chain