What do you think the starting value of totalCharCount should be? Zero, I expect. So set it to zero.
int totalCharCount = 0;
Take a loko at your other variables, and if you want them to have a specific starting value, set them. In C++, variables generally don't begin with a zero value. They begin with whatever random value is in the memory.