Counting the total number of characters in an std::set
You should make the parameter to TotalLength const, so you can use it on constant sets. Since TotalLength does not modify its argument, there is no reason not to use a const reference.

Also this is a small thing, but I'd change the name of SumLength to AddLength as Sum to me suggests that it operates on multiple strings.

Other than that your code looks perfectly fine and straight forward.