Skip to main content
LIVE CONTEST: Round #7 · Begin Marathon is live now! …

~/algor $ cat problems/string/first-and-last-position-of-a-letter

First and last position of a letter

Author Iqbolshoh Ilhomjonov 3 @iqbolshoh 650 problems
Easy 1000 ms 64 MB 22%
Share

A string and a letter are given. At which positions does occur in for the first and for the last time? Positions are numbered from . If the letter occurs once, both numbers are the same; if it does not occur at all, print .

The letters of the string with their positions; the first and last occurrences of the given letter are highlighted

Input

The first line contains the string , the second line a single letter .

Output

Two space-separated integers or .

Note


and consist of lowercase Latin letters

Examples

Input #1
algoritm
o
Output #1
4 4
Input #2
salom
z
Output #2
-1

Sign in to submit a solution

Signing up is free and takes a minute.