# Finding vaccine

## Problem:-

You are creating a vaccine to fight against a worldwide novel pandemic virus. A vaccine contains a weakened virus that is injected inside people to produce antibodies to let it fight against the virus. The study of interaction among RNA of various viruses is quite necessary for this. An RNA consists of four types of molecules Guanine ($G$), Adenine ($A$), Cytosine ($C$), and Uracil ($U$).
You are given the structures of RNA for the pandemic virus and several vaccine viruses in the form of strings containing characters $G$$A$$C$, and $U$ representing respective molecules. You know that if there is higher interaction between the pandemic virus and vaccine virus, then better the vaccine will be. You also know that the only interaction between any two RNAs is a result of the interaction between their Guanine ($G$) and Cytosine ($C$) molecules. Formally, if the strings for RNA structures are ${s}_{1}$ and ${s}_{2}$, then you must consider the following points:
• One molecule of Guanine ($G$) of ${s}_{1}$ and one molecule of Cytosine ($C$) of ${s}_{2}$ will lead to one unit of interaction.
• One molecule of Guanine ($G$) of ${s}_{2}$ and one molecule of Cytosine ($C$) of ${s}_{1}$ will lead to one unit of interaction.
• Any other pair of molecules do not add to any interactions.
In this way, the total interaction between ${s}_{1}$ and ${s}_{2}$ is calculated as the sum of individual molecule pair interactions (as discussed above).
You must find the best available vaccine.
Input format
• The first line contains a single integer $n$ denoting the number of vaccines
• The second line contains a single integer $m$ denoting the length of the string denoting the RNA structure for the pandemic virus.
• The third line contains a string $r$ denoting the RNA structure for the pandemic virus.
• Next $2n$ lines contains the following lines where:
• $\left(2i-1{\right)}^{th}$ line contains a single integer ${l}_{i}$ denoting the length of the string denoting the RNA structure for the ${i}^{th}$ vaccine virus
• $\left(2i{\right)}^{th}$ line contains a string ${s}_{i}$ denoting the RNA structure for the ${i}^{th}$ vaccine virus
Output format
Print a single integer $k$ if the ${k}^{th}$ vaccine is the best, that is, it has the maximum interaction with pandemic virus RNA, where $1\le k\le n$ obviously holds.
If there are more than one answers possible (in case of two or more have the maximum interaction value), then print the smallest answer possible.
Constraints
SAMPLE INPUT

2
5
ACGGU
6
AGCAAA
8
UAUAAGAG

SAMPLE OUTPUT

1
Explanation
RNA of MARS-20 virus contains 2 molecules of G and 1 molecule of C.
Interaction with first vaccine = 3 units
Interaction with second vaccine = 2 units

## Solution:-

Here we first calculate the number of G and C in RNA structure of virus .Which is denoted as no_G and no_C . and then scan vaccine one by one and calculate the number of G and C in vaccine. which is store in new_C and new_D. And then apply vaccine=new_C*no_G+new_G*no_C .
#include<stdio.h>
int main()
{
int n,m,no_C=0,no_G=0,new_G=0,new_C=0,sum=0,pre_length=0,k=0,ans=0, vaccine,length;
char str[1000],vac[1000];
scanf("%d%d",&n,&m);
scanf("%s",vac);
for(int i=0;i<m;i++)
{
if(vac[i]=='G')
no_G++;
if(vac[i]=='C')
no_C++;
}
for(int i=0;i<n;i++)
{
new_C=0;
new_G=0;
scanf("%d",&length);
scanf("%s",str);
k++;
for(int j=0;str[j];j++)
{
if(str[j]=='G')
new_G++;
if(str[j]=='C')
new_C++;
}
vaccine=new_C*no_G+new_G*no_C;
if(sum<vaccine)
{
sum=vaccine;
ans=k;
pre_length=length;
}
if(sum==vaccine)
{
if(pre_length>length)
pre_length=length;
}
}
printf("%d",ans);
return 0;
}