Help me in solving FANCY problem

My issue

plz debugging this code, why throw error ?

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here

long long int t;
	cin>>t;
	while(t--){
	    string s;
	    int c1=0;
	    getline(cin,s);
	    int q=s.length();
	     for(int i=0;i<q;i++){
	       
	         if(s[i]=='n' && s[i+1]=='o'  && s[i+2]=='t' )  {
	              
           
                if( (i==0 || s[i-1]==' ') && (s[i+3]==' '|| i==q-3 )){
                c1=1;  }
           
	         }
	             
	        
	     }
	    if(c1==1 ){ cout<<"Real Fancy"<<endl;}
	    
	    else{cout<<"regularly fancy"<<endl;}
	}
	return 0;
}

Problem Link: FANCY Problem - CodeChef

@deepakjdh31
U code is right just a little addition u have to right cin.ignore() after taking input of test cases to ignore first garbage input;
like this

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here

long long int t;
	cin>>t;
	cin.ignore();
	while(t--){
	    string s;
	    int c1=0;
	    getline(cin,s);
	    int q=s.length();
	     for(int i=0;i<q-2;i++){
	       
	         if(s[i]=='n' && s[i+1]=='o'  && s[i+2]=='t' )  {
	              
           
                if( (i==0 || s[i-1]==' ') && (s[i+3]==' '|| i==q-3 )){
                c1=1;  }
           
	         }
	             
	        
	     }
	    if(c1==1 ){ cout<<"Real Fancy"<<endl;}
	    
	    else{cout<<"regularly fancy"<<endl;}
	}
	return 0;
}
           
              ```