#abc305b. B - ABCDEFG

B - ABCDEFG

Score : 200200 points

问题描述

有7个点A、B、C、D、E、F和G按照顺序位于一条直线上。(参见下图)

  • A与B之间的距离:3
  • B与C之间的距离:1
  • C与D之间的距离:4
  • D与E之间的距离:1
  • E与F之间的距离:5
  • F与G之间的距离:9

已给出两个大写英文字母ppqq。其中,ppqq分别为ABCDEFG,并且满足pqp \neq q

请计算点pp和点qq之间的距离。

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

Problem Statement

There are 77 points AA, BB, CC, DD, EE, FF, and GG on a straight line, in this order. (See also the figure below.)
The distances between adjacent points are as follows.

  • Between AA and BB: 33
  • Between BB and CC: 11
  • Between CC and DD: 44
  • Between DD and EE: 11
  • Between EE and FF: 55
  • Between FF and GG: 99

image

You are given two uppercase English letters pp and qq. Each of pp and qq is A, B, C, D, E, F, or G, and it holds that pqp \neq q.
Find the distance between the points pp and qq.

Constraints

  • Each of pp and qq is A,B,C,D,E,F, or G.
  • pqp \neq q

Input

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

pp qq

Output

Print the distance between the points pp and qq.

Sample Input 1

A C

Sample Output 1

4

The distance between the points AA and CC is 3+1=43 + 1 = 4.

Sample Input 2

G B

Sample Output 2

20

The distance between the points GG and BB is 9+5+1+4+1=209 + 5 + 1 + 4 + 1 = 20.

Sample Input 3

C F

Sample Output 3

10

update @ 2024/3/10 08:35:53