Skip to content

Latest commit

 

History

History

re-start-re-end

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Re.start() & Re.end()

https://www.hackerrank.com/challenges/re-start-re-end

Problem

start() & end()

These expressions return the indices of the start and end of the substring matched by the group.

Task

You are given a string S.
Your task is to find the indices of the start and end of string k in S.

Input format

The first line contains the string S. The second line contains the string k.

Output format

Print the tuple in this format: (start _index, end _index).
If no match is found, print (-1, -1).

Sample Input 0

aaadaa
aa

Sample Output 0

(0, 1)  
(1, 2)
(4, 5)

My Solution