• Now, what is wrong with the approach I posted?

    Where does it fail to provide the result you need?

    _____________
    Code for TallyGenerator