Given a string S consisting only ‘a’s and ‘b’s, print the last index of the ‘b’ present in it.

By ayush goel in 22 Sep 2023 | 03:51 pm
ayush goel

ayush goel

Student
Posts: 346
Member since: 21 Sep 2023

Given a string S consisting only ‘a’s and ‘b’s, print the last index of the ‘b’ present in it.

22 Sep 2023 | 03:51 pm
0 Likes
divas goyal

divas goyal

Student
Posts: 453
Member since: 22 Sep 2023

s = "abababab"

last_index = s.rfind('b')

print(last_index)


23 Sep 2023 | 02:59 pm
0 Likes

Report

Please describe about the report short and clearly.