1 solutions

  • 0
    @ 2025-12-25 16:00:30

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int ans;
    string s;
    int work(char x)
    {
        if(x=='A' || x=='B' || x=='C') return 3;
        if(x=='D' || x=='E' || x=='F') return 4;
        if(x=='G' || x=='H' || x=='I') return 5;
        if(x=='J' || x=='K' || x=='L') return 6;
        if(x=='M' || x=='N' || x=='O') return 7;
        if(x=='P' || x=='Q' || x=='R' || x=='S') return 8;
        if(x=='T' || x=='U' || x=='V') return 9;
        if(x=='W' || x=='X' || x=='Y' || x=='Z') return 10;
    }
    int main()
    {
        cin>>s;
        for(int i=0;i<s.size();i++)
            ans+=work(s[i]);
        cout<<ans;    
        return 0;
    }
    
    • 1

    Information

    ID
    1082
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    4
    Accepted
    0
    Uploaded By