#include
#include <string.h>
using namespace std;
int main(){
int t,y=0;
cin>>t;
while(t–){
string s;
getline(cin,s);
for(int i=0;i<=s.length()+1;i++){
y=0;
if((s[i]==‘n’ || s[i]==‘N’ ) && (s[i+1]==‘o’) && (s[i+2]==‘t’)){
cout<<“Real Fancy”<<endl;
y=1;
break;
}
else{
y=-1;
}
if(y==-1){
cout<<"regularly fancy"<<endl;
}
}
}
return 0;
}
Problem-FANCY Problem - CodeChef
ssjgz
November 1, 2021, 2:23pm
2
Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile!
Also - which Problem are you trying to solve?
Edit:
If it’s this: you need to output:
regularly fancy
instead of
regularly Fancy
2 Likes
Thanks for your feedback:))
Done…
But still desired output not coming
ssjgz
November 1, 2021, 3:05pm
4
Please link to your latest submission
1 Like
ssjgz
November 1, 2021, 3:27pm
8
Thanks - several things, here:
Firstly, you’re running into the same issue as this guy when reading in the lines (you have to ignore the rest of the line after you read the number of testcases - you should be able to figure out how from reading the thread.)
Secondly, you’re reading outside the bounds of s
:
for(int i=0;i<=s.length()+1;i++){
// ... snip ...
if((s[i]=='n' || s[i]=='N' ) && (s[i+1]=='o') && (s[i+2]=='t')){
2 Likes
Thankyou so much for your help
Solution - CodeChef: Practical coding for everyone
But still I guess I am leaving some test case
ssjgz
November 2, 2021, 6:58am
10
Out-of-bounds access on e.g.:
1
a
2 Likes
Understood thanks with your help:)
1 Like
sir this i just joined codechef today and this is my solution to a question which i tried but it’s not submitting even though working correctly
MY SOLUTION
ssjgz
November 15, 2021, 6:33pm
13
There might be other problems, but fix this first
Bear in mind that your submitted entry for a CodeChef problem is not being looked at by a person; a computer program is assessing your output for matching exactly to the requirements. So no input prompts, no descriptive text around the results, and make sure text outputs if any are exactly as given, including matching upper and lower case.
The part of programming you can work on here is about making the algorithms work, and (eventually, hopefully) work efficiently. The part of programming conce…
1 Like