MIME Type - Bug into outputs?

Hello

,

I think there is a bug into the exercise (i’m using PHP). I show you my inputs and my outputs :

Input
>> ‘animated.gif’
> ‘portrait.png’
> ‘index.html’

Output
>> image/gif
> image/png
> text/html
_
Failure
Found : Nothing
Expected : “i”

Note that I have not hardcoded … Could this be due to a bug? or should I make a mistake?

How do you print the result?

I print the result like this :

echo($returnMT . "\n");

Curiously, when i hardcode :

echo("image/gif\nimage/png\ntext/html");

I have the same outputs values, and the same failure message… :frowning:

Could you try again just in case?

I just took your code, commented: echo("image/gif\nimage/png\ntext/html"); and removed comment for the line echo($returnMT . "\n"); (absolutely no other modifications were done), and test 1, 2 and 4 are success.

I removed almost all the useless comments, the hardcode, and some debug instructions. It doesn’t work : same outputs, but same answer : Failure

I move the topic into “Feedback and Bug”

If I reset the code and replace the default echo with yours, it works for me… I’m not sure how we can reproduce, can you send us your code to coders [at] codingame.com?

I solve it :
I did not pay attention, but I inserted a blank line before <? php on line 1. When I delete it, it works… Maybe a bug to notice or fix ?

Thank all to you and merry xmas !

That’s interesting. It’s not a bug because that’s how php works, but maybe we should remove the blank lines before and after the php tags in order to avoid that kind of issue? What do you think?

You mean at the moment of code interpretation ?
I think it may display a simple error / warning.

1 Like