-
Notifications
You must be signed in to change notification settings - Fork 272
Expand file tree
/
Copy pathComplimentToDNA.java
More file actions
36 lines (35 loc) · 864 Bytes
/
ComplimentToDNA.java
File metadata and controls
36 lines (35 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class ComplimentToDNA
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner s = new Scanner(System.in);
int t=s.nextInt();
while(t-->0)
{
int n=s.nextInt();
String str=s.next();
String ans="";
for(int i=0;i<n;i++)
{
if(str.charAt(i)=='T'){
ans+='A';
}
else if(str.charAt(i)=='A'){
ans+='T';
}
else if(str.charAt(i)=='G'){
ans+='C';
}
else{
ans+='G';
}
}
System.out.println(ans);
}
// your code goes here
}
}