Max Character Algorithm: Step-by-Step Solution