• + 0 comments

    Python:

    def stringReduction(s):
        c = [s.count(chr(i)) % 2 for i in range(97, 100)]
        return (1, 2)[sum(c) in (0, 3)] if len(set(s)) !=1 else len(s)