#abc276a. A - Rightmost

A - Rightmost

Score : 100100 points

问题描述

你将得到一个仅包含小写英文字母的字符串 SS

如果 aSS 中出现,输出它最后一次出现的索引;否则,输出 1-1。(索引从 11 开始计数。)

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given a string SS consisting of lowercase English letters. If a appears in SS, print the last index at which it appears; otherwise, print 1-1. (The index starts at 11.)

Constraints

  • SS is a string of length between 11 and 100100 (inclusive) consisting of lowercase English letters.

Input

The input is given from Standard Input in the following format:

SS

Output

Print the answer.

Sample Input 1

abcdaxayz

Sample Output 1

7

a appears three times in SS. The last occurrence is at index 77, so you should print 77.

Sample Input 2

bcbbbz

Sample Output 2

-1

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

Sample Input 3

aaaaa

Sample Output 3

5

update @ 2024/3/10 11:36:23