simplify partial cpp solution to codechef trsubtr