New update is available. Click here to update.

Excel Equivalent of a Decimal Number

Posted: 19 Dec, 2020
Difficulty: Moderate

PROBLEM STATEMENT

Try Problem

Given a positive number 'N'. Your task is to find the Excel Equivalent of the number 'N'.

Note:

1. The Excel equivalent of 1 is "A", the Excel equivalent of 2 is "B" ……………, the Excel equivalent of 26 is "Z". 

2. The Excel equivalent of 27,28…,52 is "AA", "AB"…."AZ" respectively.

3. The Excel Equivalent of 53,54….78 is "BA", "BB"….."BZ".

4. The pattern shown above can be used to find the excel equivalent of any positive number.

5. There is only one Excel Equivalent for a given positive number.
Input format:
The first line of input contains an integer ‘T’ denoting the number of test cases.

The first and only line of each test case contains a number 'N' of which the Excel Equivalent is required to be found.
Output format:
For each test case, return the Excel equivalent of a given number in a separate line.
Note:
You don't need to print anything, it has already been taken care of. Just implement the given function.
Follow Up:
Can you solve this in logarithmic time and space complexity?
Constraints:
1 <= T <= 1000
1 <= N <= 10^15

Time limit: 1sec