class Solution { public int titleToNumber(String s) { char[] chas = s.toCharArray(); int res=0; int temp=1; for(int i=chas.length-1;i>-1;i--) { int cur=chas[i]-'A'+1; res+=cur*temp; temp*=26; } return res; } }