min function
factory for creating recursive char counter