You've successfully subscribed to The Poor Coder | Hackerrank Solutions
Great! Next, complete checkout for full access to The Poor Coder | Hackerrank Solutions
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Hackerrank - Re.split() Solution

Hackerrank - Re.split() Solution

Beeze Aal
Beeze Aal

Check Tutorial tab to know how to to solve.

You are given a string  consisting only of digits 0-9, commas ,, and dots .

Your task is to complete the regex_pattern defined below, which will be used to re.split() all of the , and . symbols in .

It’s guaranteed that every comma and every dot in  is preceeded and followed by a digit.

Sample Input 0

100,000,000.000

Sample Output 0

100
000
000
000

Solution in Python

regex_pattern = r"[.,]"	
import re
print("\n".join(re.split(regex_pattern, input())))