Is it a Sololearn Code Couch Bug ? [Pig Latin] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it a Sololearn Code Couch Bug ? [Pig Latin]

I wrote some code in Pig Latin task, and it really works right! In test cases Your Output and Expected output are identical!!! But it still shows an error ! It is very unusual, because I cphecked that my code DOESN'T output spaces at the end, and there was no uninitialised memory at the end of output. Your output and Expected output are really identical ! Is it a Sololearn Code Couch Bug? Or my code is not valid? Screens: https://imgur.com/a/nqux87N My code : pinned. https://code.sololearn.com/cOyGHauuLZXt/?ref=app

9th Aug 2020, 10:30 AM
Monat15
Monat15 - avatar
2 Answers
+ 2
It's not a bug, your code is not valid. Keep in mind some ASCII characters do not have a graphical represantation on the console, null characters are among them. With string problems, especially when using C-strings instead of C++-strings, there is always a high likelihood you are printing a null character somewhere when the solutions seem to match otherwise (the string comparison will fail due to the extra null character in the buffer, albeit not visible). The fix is rather simple in this case, but maybe you can find it by yourself. As a hint: At what index position do you start copying characters into the default-initialized "stra1"?
9th Aug 2020, 3:04 PM
Shadow
Shadow - avatar
+ 1
Yes, you're right, the first (zero) element of "stra1" was not wrote by my program, but with "for" cycle I tried to display it. I rewrote code a little, now it can work with zero array element. And it works in Code Couch. Thank you for answer.
9th Aug 2020, 3:44 PM
Monat15
Monat15 - avatar