Arduino Mega 2560 Serial Input Cycle Problem

So maybe you post the code that shows that behavior.

The code that you posted above, can not compile.