Solve problem "The first and last occurrence" online - Learn Python 3 - Snakify

Problem «The first and last occurrence» (Medium)


Statement

Given a string that may or may not contain a letter of interest. Print the index location of the first and last appearance of f. If the letter f occurs only once, then output its index. If the letter f does not occur, then do not print anything.

Don't use loops in this task.


In all the problems input the data using input() and print the result using print().



Saved solutions

Tests

Input Correct answer Result
comfort
3
office
1 2
hello
fffffffffffffff
0 14
aaaaaaaaaaaaaaaaaaaaafaaaaaaaaaaaaaaaaaaaaaaaa
21
aaaaaaaaaaaaaaaaaaaaaaaaffaaaaaaaaaaaaaaaaaaaa
24 25
afafafafafafafa
1 13