Many spreadsheet applications use positive integers to label rows of cells and strings to label columns of cells. Your task is to write a function that gets the number of the column and returns its label.
All 26 uppercase letters are used to label the columns. Column labels are ordered according to their length, and labels with the same length are ordered in alphabetical order. Thus, the first 26 columns have a one-letter label, the following 26*26 columns have a two-letter label.
The sequence of the labels looks as follows:
A, B, C, ..., Z, AA, AB, ..., AZ, BA, BB, ..., ZY, ZZ
The columns are numbered from 1, i.e., column number 1 has the label A.
|