POJ C Programming Advanced Programming Problem # #: Pairing base chain

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.