Baidu 2016 internship front-end questions in the programming problem 2:excel address of the mutual conversion [2015 Nan Qiao Cup questions]

Source: Internet
Author: User
Tags integer numbers

Baidu 2016 internship in the front-end questions of the programming problem 2:excel address of the mutual conversion


Excel is the most commonly used office software. Each cell has a unique address representation. For example, the 12th row 4th column is indicated as: "D12", 5th row No. 255 column is represented as "IU5".
In fact, Excel provides two ways to address representations, and there is a notation called RC format address. The 4th column of line 12th is indicated as "R12C4" and the 5th row No. 255 column is denoted as "r5c255". Requirements: Write a program, swap two different representations of the column, that is, if the input is a regular address format, output the RC address format, if the input is the RC address format, output the general address format. "Input, output format requirements"


Sample Example
Input:


2
R12c4
BC23

Output:
D12
R23c55


Original source: Http://codeforces.com/problemset/problem/1/B (codeforces Beta Round #1)

B. SpreadsheetsTime limit per test10 secondsMemory limit per Test64 megabytesInputstandard inputOutputstandard output

In the popular spreadsheets systems (for example, in Excel) the following numeration of columns are used. The first column has A number A, the Second-number B, etc. till column, which is marked by Z. Then there was Two-letter Numbers:column have number AA, 28-ab, column is marked by AZ. After ZZ there follow three-letter numbers, etc.

The rows is marked by an integer numbers starting with 1. The cell name is the concatenation of the column and the row numbers. For example, BC23 are the name for the cell, which is in column, row 23.

Sometimes another numeration system is used:rxcy, where X and Y are integer numbers, showing the column and the row Numbe RS respectfully. For instance, r23c55 are the cell from the previous example.

Your task is to write a program this reads the given sequence of cell coordinates and produce each item written according To the rules of another numeration system.

Input

the first line of the input contains integer number  n   (1?≤? n ? ≤?10 5 ), the number of coordinates in the test. Then there follow  n Lines, each of them contains coordinates. All the coordinates is correct, there is no cells with the column and/or the row numbers larger Than 106  .

Output

Write n lines, each of the line should contain a cells coordinates in the other numeration system.

Examplesinput
2r23c55bc23
Output
Bc23r23c55


Similar Chinese title Blue Bridge cup Excel address translation


Excel is the most commonly used office software. Each cell has a unique address representation. For example, the 12th row 4th column is indicated as: "D12", 5th row No. 255 column is represented as "IU5".
In fact, Excel provides two ways to address representations, and there is a notation called RC format address. The 4th column of line 12th is indicated as "R12C4" and the 5th row No. 255 column is denoted as "r5c255". Your task is to write a program that transforms from the RC address format to the regular address format. "Input, output format requirements"
The user first enters an integer n (n<100), which indicates that there are n rows of input data next. The N-row data entered is the Excel cell address notation in RC format. The program outputs n rows of data, each of which is the converted general address notation. For example:


User input:
2
R12C4 r5c255


The program should output: D12 IU5


POJ 2273 an excel-lent problem http://poj.org/problem?id=2273

Simplified version of Leetcode 168 | Excel Sheet Column Title https://leetcode.com/problems/excel-sheet-column-title/



Baidu 2016 internship front-end questions in the programming problem 2:excel address of the mutual conversion [2015 Nan Qiao Cup questions]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.