#abc285c. C - abc285_brutmhyhiizp

C - abc285_brutmhyhiizp

Score : 300300 points

问题描述

在某个平行宇宙中,AtCoder 举办了一场 AtCoder 大赛,一次性给出了 101610^{16} 道题目。
这些题目的编号(ID)按照如下方式排列:A, B, ..., Z, AA, AB, ..., ZZ, AAA, ...

换句话说,题目的 ID 按照以下顺序给出:

  • 长度为 11 的由大写英文字母组成的字符串,按字典序排序;
  • 长度为 22 的由大写英文字母组成的字符串,按字典序排序;
  • 长度为 33 的由大写英文字母组成的字符串,按字典序排序;
  • ......

给定一个字符串 SS,它是这场竞赛中某道题目的 ID,请找出该题目的索引位置。(参见示例部分)

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

In a parallel universe, AtCoder holds AtCoder Big Contest, where 101610^{16} problems are given at once.
The IDs of the problems are as follows, from the 11-st problem in order: A, B, ..., Z, AA, AB, ..., ZZ, AAA, ...

In other words, the IDs are given in the following order:

  • the strings of length 11 consisting of uppercase English letters, in lexicographical order;
  • the strings of length 22 consisting of uppercase English letters, in lexicographical order;
  • the strings of length 33 consisting of uppercase English letters, in lexicographical order;
  • ......

Given a string SS that is an ID of a problem given in this contest, find the index of the problem. (See also Samples.)

Constraints

  • SS is a valid ID of a problem given in AtCoder Big Contest.

Input

The input is given from Standard Input in the following format:

SS

Output

Print the answer as an integer.

Sample Input 1

AB

Sample Output 1

28

The problem whose ID is AB is the 2828-th problem of AtCoder Big Contest, so 2828 should be printed.

Sample Input 2

C

Sample Output 2

3

The problem whose ID is C is the 33-rd problem of AtCoder Big Contest, so 33 should be printed.

Sample Input 3

BRUTMHYHIIZP

Sample Output 3

10000000000000000

The problem whose ID is BRUTMHYHIIZP is the 101610^{16}-th (last) problem of AtCoder Big Contest, so 101610^{16} should be printed as an integer.

update @ 2024/3/10 11:55:25