ABCDEFG

AtCoder
IDabc305_b
Time2000ms
Memory256MB
Difficulty
There are $7$ points $A$, $B$, $C$, $D$, $E$, $F$, and $G$ on a straight line, in this order. (See also the figure below.) The distances between adjacent points are as follows. * Between $A$ and $B$: $3$ * Between $B$ and $C$: $1$ * Between $C$ and $D$: $4$ * Between $D$ and $E$: $1$ * Between $E$ and $F$: $5$ * Between $F$ and $G$: $9$ ![image](https://img.atcoder.jp/ghi/abc305b_33d2c7bcdf92725cf9145e524f6907c76fd1f50fe06fd37b511b8bd3c27e3638.jpg) You are given two uppercase English letters $p$ and $q$. Each of $p$ and $q$ is `A`, `B`, `C`, `D`, `E`, `F`, or `G`, and it holds that $p \neq q$. Find the distance between the points $p$ and $q$. ## Constraints * Each of $p$ and $q$ is `A`,`B`,`C`,`D`,`E`,`F`, or `G`. * $p \neq q$ ## Input The input is given from Standard Input in the following format: $p$ $q$ [samples]
Samples
Input #1
A C
Output #1
4

The distance between the points $A$ and $C$ is $3 + 1 = 4$.
Input #2
G B
Output #2
20

The distance between the points $G$ and $B$ is $9 + 5 + 1 + 4 + 1 = 20$.
Input #3
C F
Output #3
10
API Response (JSON)
{
  "problem": {
    "name": "ABCDEFG",
    "description": {
      "content": "There are $7$ points $A$, $B$, $C$, $D$, $E$, $F$, and $G$ on a straight line, in this order. (See also the figure below.)   The distances between adjacent points are as follows. *   Between $A$ and ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc305_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "There are $7$ points $A$, $B$, $C$, $D$, $E$, $F$, and $G$ on a straight line, in this order. (See also the figure below.)  \nThe distances between adjacent points are as follows.\n\n*   Between $A$ and ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments