Compare arithmetic and string-based ways to count a number's digits, including the edge cases each approach needs to handle.