def sum_digits_single(x):
    # We want to split x into two parts a and b where a + b = x
    # such that digit_sum(a) + digit_sum(b) is maximized
    # 
    # The optimal strategy is to find the largest power of 10 that is <= x,
    # then split at (power_of_10 - 1) and (x - power_of_10 + 1)
    # This maximizes digit sums by creating numbers with all 9s
    
    def digit_sum(n):
        return sum(int(d) for d in str(n))
    
    if x == 0:
        return 0
    
    # Find the best split
    best = digit_sum(x)  # no split case (one part is 0)
    
    # Try splitting at each power of 10 minus 1
    power = 1
    while power <= x:
        a = power - 1
        b = x - a
        current = digit_sum(a) + digit_sum(b)
        if current > best:
            best = current
        power *= 10
    
    return best