```
public class Solution {
public int titleToNumber(String s) {
int index, result = 0;
for (int i = 0; i < s.length(); i++)
{
index = s.charAt(i) - 'A' + 1;
result += Math.pow(26,s.length()-i-1)*index;
}
return result;
}
}
```