102852: [AtCoder]ABC285 C - abc285_brutmhyhiizp

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:1 Solved:0

Description

Score : $300$ points

Problem Statement

In a parallel universe, AtCoder holds AtCoder Big Contest, where $10^{16}$ problems are given at once.
The IDs of the problems are as follows, from the $1$-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 $1$ consisting of uppercase English letters, in lexicographical order;
  • the strings of length $2$ consisting of uppercase English letters, in lexicographical order;
  • the strings of length $3$ consisting of uppercase English letters, in lexicographical order;
  • $...$

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

Constraints

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

Input

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

$S$

Output

Print the answer as an integer.


Sample Input 1

AB

Sample Output 1

28

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


Sample Input 2

C

Sample Output 2

3

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


Sample Input 3

BRUTMHYHIIZP

Sample Output 3

10000000000000000

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

Input

题意翻译

给你一个由大小写字母组成的字符串,A 对应 $1$,B 对应 2,C 对应 $3$,以此类推。最后将字符串看作一个二十六进制的整数,如 ABC 看作 $(123)_ {26}$,求这个数在十进制中对应的数。 translate by @[VT_SODC3DC3BSLF](https://www.luogu.com.cn/user/672333)

Output

分数:300分

问题描述

在一个平行宇宙中,AtCoder举办了一场AtCoder大型比赛,一次性给出了10^16个问题。
问题的编号如下,从第1个问题开始:A, B, ..., Z, AA, AB, ..., ZZ, AAA, ...

换句话说,编号按照以下顺序给出:

  • 由大写英文字母组成的长度为1的字符串,按字典序排列;
  • 由大写英文字母组成的长度为2的字符串,按字典序排列;
  • 由大写英文字母组成的长度为3的字符串,按字典序排列;
  • ...

给定一个字符串S,它是本次比赛中一个问题的编号,找到该问题的索引。 (请参阅示例。)

约束

  • S是AtCoder大型比赛中一个有效的问题编号。

输入

输入按照以下格式从标准输入给出:

$S$

输出

将答案作为整数打印。


样例输入1

AB

样例输出1

28

编号为AB的问题是AtCoder大型比赛的第28个问题,因此应该打印28。


样例输入2

C

样例输出2

3

编号为C的问题是AtCoder大型比赛的第3个问题,因此应该打印3。


样例输入3

BRUTMHYHIIZP

样例输出3

10000000000000000

编号为BRUTMHYHIIZP的问题是AtCoder大型比赛的第10^16个(最后一个)问题,因此应该将10^16打印为整数。

加入题单

算法标签: