hackerrank.com

Practice>Python>Regex and Parsing>Re.start() & Re.end()

건이두 2019. 4. 4. 12:43
728x90

hackerrank.com

Re.start() & Re.end()

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

Difficulty : Easy

Tip

  • re.search() start() and end() methods are described in problme description
  • re.finditer() is a key method, as it return all occurences which is matched with given regular expression
  • start() == end() from re.finditer() 
  • start() != end() from re.search() 
  • So, we should use start() and start() + len(k) -`1

Solution

 

728x90