102760: [AtCoder]ABC276 A - Rightmost

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:7 Solved:0

Description

Score : $100$ points

Problem Statement

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$

Output

Print the answer.


Sample Input 1

abcdaxayz

Sample Output 1

7

a appears three times in $S$. The last occurrence is at index $7$, so you should print $7$.


Sample Input 2

bcbbbz

Sample Output 2

-1

a does not appear in $S$, so you should print $-1$.


Sample Input 3

aaaaa

Sample Output 3

5

Input

题意翻译

输入一个由小写英文字母构成的字符串 $S$,如果字符串中有 `a` 就输出位置最靠右的 `a` 的下标(下标从 $1$ 开始),否则就输出 $-1$。 $1\le\vert S \vert\le 100$。

Output

得分:$100$分

问题描述

你得到了一个由小写英文字母组成的字符串$S$。
如果字符串$S$中出现字符a,则打印它出现的最后一个位置的索引;否则,打印$-1$。(索引从$1$开始。)

约束

  • $S$是一个长度在$1$到$100$(含)之间的由小写英文字母组成的字符串。

输入

输入将从标准输入中以以下格式给出:

$S$

输出

打印答案。


样例输入 1

abcdaxayz

样例输出 1

7

a在$S$中出现了三次。最后一次出现的索引是$7$,所以你应该打印$7$。


样例输入 2

bcbbbz

样例输出 2

-1

a没有出现在$S$中,所以你应该打印$-1$。


样例输入 3

aaaaa

样例输出 3

5

加入题单

算法标签: