Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <algorithm>
- #include <cstring>
- #include <string>
- #include <cctype>
- #include <stack>
- #include <bitset>
- #include <queue>
- #include <list>
- #include <vector>
- #include <map>
- #include <set>
- #include <iterator>
- #include <sstream>
- #include <stdlib.h>
- #include <cmath>
- #define FOR(i,A) for(typeof (A).begin() i = (A).begin() ; i != (A).end() ; i++)
- #define debug( x ) cout << #x << " = " << x << endl
- #define clr(v,x) memset( v, x , sizeof v )
- #define all(x) (x).begin() , (x).end()
- #define rall(x) (x).rbegin() , (x).rend()
- #define TAM 110
- using namespace std;
- typedef pair<int,int> ii ;
- typedef long long ll ;
- typedef long double ld ;
- typedef pair<int,ii> pii ;
- char cad[255];
- int main() {
- map<char,int> mp;
- mp['A']=1;mp['B']=2;mp['C']=3;mp['D']=4;mp['E']=5;mp['F']=6;
- mp['G']=7;mp['H']=8;mp['I']=9;mp['J']=10;mp['K']=11;mp['L']=12;
- mp['M']=13;mp['N']=14;mp['O']=15;mp['P']=16;mp['Q']=17;mp['R']=18;
- mp['S']=19;mp['T']=20;mp['U']=21;mp['V']=22;mp['W']=23;mp['X']=24;
- mp['Y']=25;mp['Z']=26;
- while(gets(cad)){
- if(strcmp(cad,"#")==0) break;
- int n=strlen(cad);int sum=0;
- for(int i=0;i<n;i++){
- if(isalpha(cad[i])){
- sum+=(mp[(toupper(cad[i]))] * (i+1));
- }
- }
- printf("%d\n",sum);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement