Everyone can solve this kind of problems

But, almost every people can not be accept in one submittion.

A lot of edge cases, good luck.