```
int titleToNumber(string s) {
int length = s.length();
int sum = 0;
for(int i=0;i<length;i++){
int tmp = int(s[i]) - 64;
for(int j=0;j<(length-i-1);j++){
tmp *= 26;
}
sum += tmp;
}
return sum;
}
```