func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int n, a, b;   long long int S(long long int x) {     int ret = 0;     long long int y = n - x;     while (x > 0) {       ret += x % 10;       x /= 10;     }     while (y > 0) {       ret += y % 10;       y /= 10;     }     return ret;   }   long long int solve(long long int x) {     long long int b = 1, ans = x;     while (x) {       long long int cur = (x - 1) * b + (b - 1);       if (S(cur) > S(ans)) {         ans = cur;       }       x /= 10;       b *= 10;     }     return ans;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n;     cout << S(solve(n));     return 0;   }   