Https://www.codechef.com/viewsolution/33810938

I don’t know why my answer is wrong. Is there anyone who can help me out.
Qn link : https://www.codechef.com/problems/FANCY
My ans : https://www.codechef.com/viewsolution/33810938

consider this test case
1
not(space)
space may be possible even after last word.
answer should be “real fancy”

1 Like

yeah i have seen it , Corrected but still not accepting

Can you share updated code?

`
#include

using namespace std;

int main()
{

int t;
cin>>t;
cin.ignore();
string a;
while(t–)
{
getline(cin,a);
int spos=0,epos=-1;
char c[3]={‘n’,‘o’,‘t’};
char found=‘n’;
for(int i=0;i<a.size();i++)
{
epos=-1;
found=‘n’;
if(a[i]==’ ‘||i==a.size()-1)
{
if(a[i]==’ ')
epos=i;
else if(i==a.size()-1)
epos=i+1;
else
epos=i;
}
if(epos!=-1)
{
if(epos-spos==3)
{
for(int j=0;j<3;j++)
{
if(a[spos+j]==c[j])
{
found=‘y’;
}else
found=‘n’;
}
}else
{
found=‘n’;
spos=epos+1;
}
if(found==‘y’)
break;
}
}
if(found==‘y’)
cout<<“Real Fancy\n”;
else
cout<<“regularly fancy\n”;
}
return 0;
}
`

Format your code or give link to submission. Use ``` symbol at the start and end of code for formatting.

1 Like

re_edited

Put that symbol three times

https://www.codechef.com/viewsolution/33820955

bro i have done it but …

If last character is ‘t’ then your code will print Real Fancy. Try s=ant

2 Likes