POJ 3623 - Best Cow Line, Gold

Solution: For the remainder line, if the normal order is larger than revert order, choose the front initial, otherwise choose the last initial.
Hint: The greedy scan can also solve this problem in O(n) time.
State: AC in first submit.