# -*- coding: utf-8 -*-
"""
Created on Wed Jul  7 21:55:35 2021

@author: Farzana Eva
"""
"""
PROBLEM STATEMENT:
Given a positive integer A, return its corresponding column title as appear in an Excel sheet.
Problem Constraints
1 <= A <= 1000000000
Input Format
First and only argument is integer A.
Output Format
Return a string, the answer to the problem.
Example Input
Input 1:
 A = 1
Input 2:
 A = 28
Example Output
Output 1:
 "A"
Output 2:
 "AB"
Example Explanation
Explanation 1:
 1 -> A
Explanation 2:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB 
"""

def convertToTitle(A):
    col = ""

    while A > 0:
        if A%26 != 0:
            col += chr(65 + (A%26) -1)
            A = A//26
        else:
            col += 'Z'
            A = A//26 -1

    return col[::-1]