英文题目翻译day2

Spreadsheets(电子表格)

每次测试时间限制:10秒   

每次测试存储限制:64Mb

输入:标准输入

输出:标准输出

在流行的电子表格系统中(例如,在Excel中)对columns列使用了如下的计数规则。第1列记为A,第2列记为B,以此类推。知道第26列被标记为Z。接下来有两个记数字母:第27列记为AA,第28列为AB,第52列被标记为AZ。ZZ之后接着采用三个记数字母,以此类推。

Rows(行)从整数1开始标记。Cell(单元格)的名称由列和行计数规则组成。例如,BC23是第55列,第23行的单元格名称。

有时则采用另一种计数规则:RXCY,X和Y表示整数,依次显示出列数和行数。例如,R23C55是先前单元格的表示。

你的任务是编写一个程序,读取所给的每个sequence of cell coordinates(单元坐标序列)并且通过另一种计数方式输出。

输入

第一行输入包含一个整数n(1<=n<=1e5),为测试coordinates(坐标)的数量。接下来有n行,每行包含一个坐标。所有的坐标应保证合法,单元格的列数和行数不超过1e6。

输出

输出n行,每行应该包含一个采用另一种计数方式的单元格坐标。

样例测试

输入

2

R23C55

BC23

输出

BC23

R23

C55

Spreadsheets

time limit per test: 10 seconds

memory limit per test: 64 megabytes

input: standard input

output: standard output

In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow three-letter numbers, etc.

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

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

Your task is to write a program that 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 ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .

Output

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

Sample test(s)

input

2

R23C55

BC23

output

BC23

R23C55

上一篇:Python(2)


下一篇:翻译