My issue
My code
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int n,i;
cin>>n;
string s;
string t;
cin>>s;
for(i=0;i<n;i++)
{
if(s[i]!='.')
{
t+=s[i];
}
}
int b=t.length();
bool ans=true;
if(b%2==0)
{
for(i=0;i<b-1;i+2)
{
if((t[i]=='H')&&(t[i+1]=='T'))
{
ans=true;
}
else
{
ans=false;
break;
}
}
}
else
{
ans=false;
}
if(ans)
cout<<"Valid"<<endl;
else
cout<<"Invalid"<<endl;
}
return 0;
}
Problem Link: SNAKPROC Problem - CodeChef