Problem2463--Rightmost a

2463: Rightmost a

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

给定一个由小写英文字母组成的字符串S,请确定该字符串中是否存在小写字母a,如果存在,请打印出最右边那个a的位置序号(注意,序号从1开始计算),如果不存在a,请打印-1

Sample Input Copy

abcdaxayz

Sample Output Copy

7

HINT

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

Source/Category