HackerRank Python - Group(), Groups() & Groupdict()

A group() expression returns one or more subgroups of the match.

A groups() expression returns a tuple containing all the subgroups of the match.

A groupdict() expression returns a dictionary containing all the named subgroups of the match, keyed by the subgroup name.

  1. # Enter your code here. Read input from STDIN. Print output to STDOUT
  2. import re
  3. m = re.search(r'([a-zA-Z0-9])\1', input().strip())
  4. print(m.group(1) if m else -1)
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]

donate a cup of tea :)

Join Our Facebook Group

Share this solution


Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube