def count_chars_and_digits(input_str): char_count = 0 digit_count = 0 for char in input_str: if char.isalpha(): char_count += 1 elif char.isdigit(): digit_count += 1 return (char_count, digit_count)