Problem:
Score : 200 points

Problem Statement

Takahashi has two positive integers A and B.

It is known that A plus B equals N.
Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10).

Constraints

2 ≤ N ≤ 10^5

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B".

Sample Input 1

15

Sample Output 1

6

When A=2 and B=13, the sums of their digits are 2 and 4, which minimizes the value in question.

Sample Input 2

100000

Sample Output 2

10

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

  int n;
  cin >> n;

  int a, b, c, d, e, f, g;
  int min1 = 10000;
  // for(int j = 1; j < n; j++){
  // for (int i = 1; i < j; i++){
  //   c = i % 10;
  //   d = (j - i) % 10;
  //   //cout << i / 10 + c + (27 - i) / 10 + d << endl;
  //   min1 = min(min1, i / 10 + c + (j - i) / 10 + d);
  // }
  //
  // cout << j << ": " << min1 << endl;
  // min1 = 10000;
  //
  // }


  a = n % 10;
  b = (n % 100) / 10;
  c = (n % 1000) / 100;
  d = (n % 10000) / 1000;
  e = (n % 100000) / 10000;
  g = (n % 1000000) / 100000;

  if (a+b+c+d+e+g == 1){
    f = 10;
  }else{
    f = a+b+c+d+e+g;
  }

  cout << f<< endl;



  return 0;
}