Excel Sheet Column Number Problem Statement

You are provided with a string STR representing a column title in an Excel Sheet. Your task is to determine the corresponding column number.

Example:

A typical example includes: A corresponds to 1, B to 2, C to 3, ..., Z to 26, AA to 27, and so on.

Input:

The first line of input contains a single integer T, representing the number of test cases or queries to be executed.
The subsequent T test cases follow.
The first and only line of each test case contains a string STR denoting the column title. It is guaranteed that all characters are uppercase English alphabets.

Output:

For each test case, output the corresponding Excel column number of STR.
The result of each query should be printed on a new line.

Constraints:

  • 1 ≤ T ≤ 50
  • 1 ≤ |STR| ≤ 12

Here, T denotes the number of test cases, and |STR| denotes the length of the string.

Time Limit : 1 sec

Be the first one to answer
Add answer anonymously...
Lowe's Full Stack Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter