0
Where I went wrong?
This is a code coach problem.named spy life my output and the expected output are same but still it is showing an error and no test case is passed... indentation,spaces or capitalization all are fine..yet error persist.. Can anyone help me with this..?? https://code.sololearn.com/cnzBhc7hAQHZ/?ref=app Editor.:: https://www.sololearn.com/coach/55?ref=app
9 ответов
+ 2
Line 8: using scanf in C would fail to recognise space separated strings.
Try scanf("%[^\n]%*c", a); instead
Although, simply using scanf works fine if input is a single token
Line 17:
for(int k=strlen(O);k>=0;k--)
k should start with strlen(O) - 1
You may also use (k=t)
+ 1
you could do it without the second loop and without o[50] by printing each char every time.
there's an extra char since you are iterating with the whole strlen()
should be strlen(a) - 1 ;
and you didn't give yourself enough memory by limiting array size to 50.
https://code.sololearn.com/cGTKdj39NWB9/?ref=app
+ 1
Bahha🐧 I did something similar
+ 1
fgets(a, MAX_SIZE, stdin);
a - input variable
MAX_SIZE - upper limit of length
stdin - standard input
0
Infinity he used gets the first time, then changed it to scanf 😅
0
ATSHAYA KUMAR.R may be because your array size is not enough try the code I posted.
0
Try fgets(a,50,stdin);