Rightmost

AtCoder
IDabc276_a
Time2000ms
Memory256MB
Difficulty
You are given a string $S$ consisting of lowercase English letters. If `a` appears in $S$, print the last index at which it appears; otherwise, print $-1$. (The index starts at $1$.) ## Constraints * $S$ is a string of length between $1$ and $100$ (inclusive) consisting of lowercase English letters. ## Input The input is given from Standard Input in the following format: $S$ [samples]
Samples
Input #1
abcdaxayz
Output #1
7

`a` appears three times in $S$. The last occurrence is at index $7$, so you should print $7$.
Input #2
bcbbbz
Output #2
\-1

`a` does not appear in $S$, so you should print $-1$.
Input #3
aaaaa
Output #3
5
API Response (JSON)
{
  "problem": {
    "name": "Rightmost",
    "description": {
      "content": "You are given a string $S$ consisting of lowercase English letters.   If `a` appears in $S$, print the last index at which it appears; otherwise, print $-1$. (The index starts at $1$.)",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc276_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given a string $S$ consisting of lowercase English letters.  \nIf `a` appears in $S$, print the last index at which it appears; otherwise, print $-1$. (The index starts at $1$.)\n\n## Constraints...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments