+ 4
[Solved by Fernando Pozzetti] Code coach YT link finder has expected output but failed.
My .C code failed in every test case but the output seems just like expected output. #include <stdio.h> int main() { char a[42]={0}; int c=32,b=17; for(int I=0;I<=42;I++){ scanf("%c",&a[I]); } if(a[31]!=0){ for(int i=0;i<=11;i++){ printf("%c",a[c]); c++; } }if(a[31]==0){ for(int j=0;j<=11;j++){ printf("%c",a[b]); b++; } } return 0; }
7 Respuestas
+ 2
I see, I have just tried it. Could it be that the line break char is screwing it up?
+ 3
Fernando Pozzetti Oh... Thanks.
I changed i and j to 10 and it's work.
#include <stdio.h>
int main() {
char a[42]={0};
int c=32,b=17;
for(int I=0;I<=42;I++){
scanf("%c",&a[I]);
}
if(a[31]!=0){
for(int i=0;i<=10;i++){
printf("%c",a[c]);
c++;
}
}if(a[31]==0){
for(int j=0;j<=10;j++){
printf("%c",a[b]);
b++;
}
}
return 0;
}
+ 2
Try with a bigger char size. 99 will be enough.
Also, there are 2 types of links, so you will need to handle each one separately.
+ 2
Fernando Pozzetti What you mean
+ 1
Fernando Pozzetti Yes, I do think the 2 type of link in my code. It already solved, but my problem is the output just look like it's expected output but failed. If you'd like you can run this code in your playground to help me fix the code.
+ 1
Fernando Pozzetti You can see this photo.
https://www.sololearn.com/post/253029/?ref=app
+ 1
Glad to help you