Leetcode 171. Excel Sheet Column Number
int titleToNumber(char* s) {
int size = strlen(s);
int hash[26],sum=0,count=0;
if(size==0)
return 0;
else
{
for(int i=0;i<size;i++)
{
if(s[i]>90)
{
sum = s[i]-'a'+1;
count = count*26 + sum; //不同的字母有不同的倍数
}
else
{
sum = s[i]-'A'+1;
count = count*26 + sum;
}
}
}
return count;
}