Rightmost

View as PDF

Submit solution

Points: 0.10
Time limit: 2.0s
Memory limit: 1G

Author:
Problem type
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

Comments

Please read the guidelines before commenting.


There are no comments at the moment.