Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,ans=0,n,length;
    string s;
    cin>>s;
    length=s.length();
    for(i=0;i<length;i++)
    {
        n=s[i]-48;
        if(n<=5)
        {
            ans+=n;
        }
        else
        {
            if(i!=length-1)
            ans+=(10-n);
            else if(i==length-1)
            ans+=(11-n);
        }
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc:5:1: error: extended character   is not valid in an identifier
    5 |     int i,ans=0,n,length;
      | ^
a.cc:5:3: error: extended character   is not valid in an identifier
    5 |     int i,ans=0,n,length;
      |   ^
a.cc:6:1: error: extended character   is not valid in an identifier
    6 |     string s;
      | ^
a.cc:6:3: error: extended character   is not valid in an identifier
    6 |     string s;
      |   ^
a.cc:7:1: error: extended character   is not valid in an identifier
    7 |     cin>>s;
      | ^
a.cc:7:3: error: extended character   is not valid in an identifier
    7 |     cin>>s;
      |   ^
a.cc:8:1: error: extended character   is not valid in an identifier
    8 |     length=s.length();
      | ^
a.cc:8:3: error: extended character   is not valid in an identifier
    8 |     length=s.length();
      |   ^
a.cc:9:1: error: extended character   is not valid in an identifier
    9 |     for(i=0;i<length;i++)
      | ^
a.cc:9:3: error: extended character   is not valid in an identifier
    9 |     for(i=0;i<length;i++)
      |   ^
a.cc:10:1: error: extended character   is not valid in an identifier
   10 |     {
      | ^
a.cc:10:3: error: extended character   is not valid in an identifier
   10 |     {
      |   ^
a.cc:11:1: error: extended character   is not valid in an identifier
   11 |         n=s[i]-48;
      | ^
a.cc:11:3: error: extended character   is not valid in an identifier
   11 |         n=s[i]-48;
      |   ^
a.cc:11:5: error: extended character   is not valid in an identifier
   11 |         n=s[i]-48;
      |     ^
a.cc:11:7: error: extended character   is not valid in an identifier
   11 |         n=s[i]-48;
      |       ^
a.cc:12:1: error: extended character   is not valid in an identifier
   12 |         if(n<=5)
      | ^
a.cc:12:3: error: extended character   is not valid in an identifier
   12 |         if(n<=5)
      |   ^
a.cc:12:5: error: extended character   is not valid in an identifier
   12 |         if(n<=5)
      |     ^
a.cc:12:7: error: extended character   is not valid in an identifier
   12 |         if(n<=5)
      |       ^
a.cc:13:1: error: extended character   is not valid in an identifier
   13 |         {
      | ^
a.cc:13:3: error: extended character   is not valid in an identifier
   13 |         {
      |   ^
a.cc:13:5: error: extended character   is not valid in an identifier
   13 |         {
      |     ^
a.cc:13:7: error: extended character   is not valid in an identifier
   13 |         {
      |       ^
a.cc:14:1: error: extended character   is not valid in an identifier
   14 |             ans+=n;
      | ^
a.cc:14:3: error: extended character   is not valid in an identifier
   14 |             ans+=n;
      |   ^
a.cc:14:5: error: extended character   is not valid in an identifier
   14 |             ans+=n;
      |     ^
a.cc:14:7: error: extended character   is not valid in an identifier
   14 |             ans+=n;
      |       ^
a.cc:14:9: error: extended character   is not valid in an identifier
   14 |             ans+=n;
      |         ^
a.cc:14:11: error: extended character   is not valid in an identifier
   14 |             ans+=n;
      |           ^
a.cc:15:1: error: extended character   is not valid in an identifier
   15 |         }
      | ^
a.cc:15:3: error: extended character   is not valid in an identifier
   15 |         }
      |   ^
a.cc:15:5: error: extended character   is not valid in an identifier
   15 |         }
      |     ^
a.cc:15:7: error: extended character   is not valid in an identifier
   15 |         }
      |       ^
a.cc:16:1: error: extended character   is not valid in an identifier
   16 |         else
      | ^
a.cc:16:3: error: extended character   is not valid in an identifier
   16 |         else
      |   ^
a.cc:16:5: error: extended character   is not valid in an identifier
   16 |         else
      |     ^
a.cc:16:7: error: extended character   is not valid in an identifier
   16 |         else
      |       ^
a.cc:17:1: error: extended character   is not valid in an identifier
   17 |         {
      | ^
a.cc:17:3: error: extended character   is not valid in an identifier
   17 |         {
      |   ^
a.cc:17:5: error: extended character   is not valid in an identifier
   17 |         {
      |     ^
a.cc:17:7: error: extended character   is not valid in an identifier
   17 |         {
      |       ^
a.cc:21:1: error: extended character   is not valid in an identifier
   21 |             ans+=(11-n);
      | ^
a.cc:21:3: error: extended character   is not valid in an identifier
   21 |             ans+=(11-n);
      |   ^
a.cc:21:5: error: extended character   is not valid in an identifier
   21 |             ans+=(11-n);
      |     ^
a.cc:21:7: error: extended character   is not valid in an identifier
   21 |             ans+=(11-n);
      |       ^
a.cc:21:9: error: extended character   is not valid in an identifier
   21 |             ans+=(11-n);
      |         ^
a.cc:21:11: error: extended character   is not valid in an identifier
   21 |             ans+=(11-n);
      |           ^
a.cc:22:1: error: extended character   is not valid in an identifier
   22 |         }
      | ^
a.cc:22:3: error: extended character   is not valid in an identifier
   22 |         }
      |   ^
a.cc:22:5: error: extended character   is not valid in an identifier
   22 |         }
      |     ^
a.cc:22:7: error: extended character   is not valid in an identifier
   22 |         }
      |       ^
a.cc:23:1: error: extended character   is not valid in an identifier
   23 |     }
      | ^
a.cc:23:3: error: extended character   is not valid in an identifier
   23 |     }
      |   ^
a.cc:24:1: error: extended character   is not valid in an identifier
   24 |     cout<<ans;
      | ^
a.cc:24:3: error: extended character   is not valid in an identifier
   24 |     cout<<ans;
      |   ^
a.cc:25:1: error: extended character   is not valid in an identifier
   25 |     return 0;
      | ^
a.cc:25:3: error: extended character   is not valid in an identifier
   25 |     return 0;
      |   ^
a.cc: In function 'int main()':
a.cc:5:1: error: '\U000000a0' was not declared in this scope
    5 |     int i,ans=0,n,length;
      | ^
a.cc:6:2: error: expected ';' before '\U000000a0'
    6 |     string s;
      |  ^~
      |  ;
a.cc:7:2: error: expected ';' before '\U000000a0'
    7 |     cin>>s;
      |  ^~
      |  ;
a.cc:8:2: error: expected ';' before '\U000000a0'
    8 |     length=s.length();
      |  ^~
      |  ;
a.cc:9:2: error: expected ';' before '\U000000a0'
    9 |     for(i=0;i<length;i++)
      |  ^~
      |  ;
a.cc:9:13: error: 'i' was not declared in this scope
    9 |     for(i=0;i<length;i++)
      |             ^
a.cc:9:15: error: 'length' was not declared in this scope
    9 |     for(i=0;i<length;i++)
      |               ^~~~~~
a.cc:24:2: error: expected ';' before '\U000000a0'
   24 |     cout<<ans;
      |  ^~
      |  ;
a.cc:25:2: error: expected ';' before '\U000000a0'
   25 |     return 0;
      |  ^~
      |  ;