Your program is not correct.
Although your program did not crash with any test case,
it was fast enough compared to the Jutge's solution,
and it did not print any invalid character (see IC),
at least one of its outputs for some test case
did not match the output of the Jutge's solution.
The mismatches considered here are significant,
worse than those of a PE.