304 North Cardinal St.
Dorchester Center, MA 02124

Re.split() hacker rank solution – Queslers￼

Problem : Re.split() hacker rank solution

The re.split() expression splits the string by occurrence of a pattern.

``````>>> import re
>>> re.split(r"-","+91-011-2711-1111")
['+91', '011', '2711', '1111']
``````

You are given a string s 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 s.
It’s guaranteed that every comma and every dot in s is preceeded and followed by a digit.

Sample Input :

``````100,000,000.000
``````

Sample Output :

``````100
000
000
000``````

Re.split() hacker rank solution in python 2

``````# Enter your code here. Read input from STDIN. Print output to STDOUT

import re
a = re.split("[,.]",raw_input())

for k in a:
if k.isdigit(): print k``````

Re.split() hacker rank solution in python 3

``````import re
s = input()
for t in re.split(r",|\.", s):
if t != '': print(t)``````

Re.split() hacker rank solution in pypy

``````# Enter your code here. Read input from STDIN. Print output to STDOUT
import re
for item in re.split("[,.]", raw_input()):
if item:
print item
``````

Re.split() hacker rank solution in pypy 3

``````import re
# Enter your code here. Read input from STDIN. Print output to STDOUT
s = input().strip()

l = re.split(r"[,\.]+",s)

for x in l:
if x != "":
print(x)``````
Re.split() Hacker Rank Solution Review:

In our experience, we suggest you solve this Re.split() Hacker Rank Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

Re.split() is available on Hacker Rank for Free, if you are stuck anywhere between compilation, just visit Queslers to get all Hacker Rank Solution

Re.split() Hacker Rank Solution Conclusion:

I hope this Re.split() Hacker Rank Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Hacker Rank Problem & Solutions >>

Mini-Max Sum Hacker Rank Solution

String Validators Hacker Rank Solution

Text Alignment Hacker Rank solution

String validators Hacker Rank Solution