12/22

AtCoder
IDcaddi2018b_a
Time2000ms
Memory256MB
Difficulty
You are given an integer $N$ that has exactly four digits in base ten. How many times does `2` occur in the base-ten representation of $N$? ## Constraints * $1000 \leq N \leq 9999$ ## Input Input is given from Standard Input in the following format: $N$ [samples]
Samples
Input #1
1222
Output #1
3

`2` occurs three times in `1222`. By the way, this contest is held on December $22$ (JST).
Input #2
3456
Output #2
0
Input #3
9592
Output #3
1
API Response (JSON)
{
  "problem": {
    "name": "12/22",
    "description": {
      "content": "You are given an integer $N$ that has exactly four digits in base ten. How many times does `2` occur in the base-ten representation of $N$?",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "caddi2018b_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given an integer $N$ that has exactly four digits in base ten. How many times does `2` occur in the base-ten representation of $N$?\n\n## Constraints\n\n*   $1000 \\leq N \\leq 9999$\n\n## Input\n\nInpu...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments