Eating Symbols Easy

AtCoder
IDabc101_a
Time2000ms
Memory256MB
Difficulty
English · Original
Chinese · Translation
There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is $0$. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by $1$; when he eats `-`, the integer in his mind decreases by $1$. The symbols Takahashi is going to eat are given to you as a string $S$. The $i$\-th character in $S$ is the $i$\-th symbol for him to eat. Find the integer in Takahashi's mind after he eats all the symbols. ## Constraints * The length of $S$ is $4$. * Each character in $S$ is `+` or `-`. ## Input Input is given from Standard Input in the following format: $S$ [samples]
高桥的脑海中总是有一个整数。 最初,高桥脑海中的整数是 $0$。高桥现在将依次处理四个符号,每个符号为 `+` 或 `-`。当他处理 `+` 时,他脑海中的整数增加 $1$;当他处理 `-` 时,他脑海中的整数减少 $1$。 高桥将要处理的符号以字符串 $S$ 给出。$S$ 的第 $i$ 个字符是他将要处理的第 $i$ 个符号。 请找出高桥处理完所有符号后,他脑海中的整数。 ## Constraints * $S$ 的长度为 $4$。 * $S$ 中的每个字符均为 `+` 或 `-`。 ## Input 输入从标准输入按以下格式给出: $S$ [samples]
Samples
Input #1
+-++
Output #1
2

*   Initially, the integer in Takahashi's mind is $0$.
*   The first integer for him to eat is `+`. After eating it, the integer in his mind becomes $1$.
*   The second integer to eat is `-`. After eating it, the integer in his mind becomes $0$.
*   The third integer to eat is `+`. After eating it, the integer in his mind becomes $1$.
*   The fourth integer to eat is `+`. After eating it, the integer in his mind becomes $2$.

Thus, the integer in Takahashi's mind after he eats all the symbols is $2$.
Input #2
\-+--
Output #2
\-2
Input #3
\----
Output #3
\-4
API Response (JSON)
{
  "problem": {
    "name": "Eating Symbols Easy",
    "description": {
      "content": "There is always an integer in Takahashi's mind. Initially, the integer in Takahashi's mind is $0$. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the intege",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc101_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "There is always an integer in Takahashi's mind.\nInitially, the integer in Takahashi's mind is $0$. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the intege...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "高桥的脑海中总是有一个整数。\n最初,高桥脑海中的整数是 $0$。高桥现在将依次处理四个符号,每个符号为 `+` 或 `-`。当他处理 `+` 时,他脑海中的整数增加 $1$;当他处理 `-` 时,他脑海中的整数减少 $1$。\n高桥将要处理的符号以字符串 $S$ 给出。$S$ 的第 $i$ 个字符是他将要处理的第 $i$ 个符号。\n请找出高桥处理完所有符号后,他脑海中的整数。\n\n## Constra...",
      "is_translate": true,
      "language": "Chinese"
    }
  ]
}
Full JSON Raw Segments