Related to question Excel Sheet Column Title
Given a column title as appear in an Excel sheet, return its corresponding column number.
class Solution {
public:
int titleToNumber(string s) {
int n= s.length(),cnt=0;
for(int i=0;i<n;i++){
cnt*=26;
cnt+=s[i]-'A'+1;
}
return cnt;
}
};