+ 2

I was trying "Security" in code coach challenges but my output is repeating many times , how can i solve it

include <stdio.h> #include <string.h> int main () { char str[105]={}; char q[100]={'q','u','i','e','t','\0'}; char A[100]={'A','L','A','R','M','\0'}; scanf ("%[^\n]", &str); int len=strlen(str); for (int x=0; x<len;x++) { if ((str[x]=='x' && str[len-1]=='T')) { printf("%s",q); } else { printf("%s",A); } } return 0; }

10th Jun 2020, 8:04 AM
Varun N
Varun N - avatar
1 ответ
+ 2
Hey Varun N ,just check this one ,what you need to do is just 'BREAK THE LOOP' when just printed even I think it might not pass all cases so just see this code for reference.. https://code.sololearn.com/ch8lN18h6hSc/?ref=app
10th Jun 2020, 10:55 AM
Nikhil Maroju
Nikhil Maroju - avatar