Statistics

Problem Statement for "Spreadsheet"

Problem Statement

In all modern spreadsheet apps the columns are labelled using strings of uppercase English letters. From the left to the right, the labels look as follows:

  1. First, there are all 26 possible 1-letter labels, in alphabetical order: "A", "B", "C", ..., "Y", "Z".
  2. Then, there are all 26^2 possible 2-letter labels, in alphabetical order: "AA", "AB", "AC", ..., "AY", "AZ", "BA", "BB", ..., "ZX", "ZY", "ZZ".
  3. Then, there are all 26^3 possible 3-letter labels, in alphabetical order: everything from "AAA" to "ZZZ".
  4. Afterwards, there are all possible labels with 4, 5, 6, ... letters.

You are given the String column: the label of a column in a spreadsheet.

Return the label of the column that is immediately to the right of the given column.

Definition

Class:
Spreadsheet
Method:
goRight
Parameters:
String
Returns:
String
Method signature:
String goRight(String column)
(be sure your method is public)

Constraints

  • column will contain between 1 and 10 characters, inclusive.
  • Each character of column will be an uppercase English letter ('A'-'Z').

Examples

  1. "SRM"

    Returns: "SRN"

  2. "Z"

    Returns: "AA"

    The column "Z" is the last column with a one-letter name. The next column is the first column with a two-letter name: "AA".

  3. "TOPCODER"

    Returns: "TOPCODES"

  4. "WALTZ"

    Returns: "WALUA"

  5. "BUZZZ"

    Returns: "BVAAA"

  6. "ZZ"

    Returns: "AAA"

  7. "ZZZZZZZZZZ"

    Returns: "AAAAAAAAAAA"

  8. "AZZZZZZZZZ"

    Returns: "BAAAAAAAAA"

  9. "PIZZAZZ"

    Returns: "PIZZBAA"

  10. "TENLETTERS"

    Returns: "TENLETTERT"

  11. "B"

    Returns: "C"

  12. "AAZZ"

    Returns: "ABAA"


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: