Skip to content

Commit a4226f6

Browse files
committed
Regex and Parsing 2-3
1 parent c49e8b2 commit a4226f6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Group(), Groups() & Groupdict()
2+
# https://www.hackerrank.com/challenges/re-group-groups/problem
3+
4+
import re
5+
6+
s = re.search(r'(?!_)(\d|\w)\1', input())
7+
print('-1' if s is None else s.group(0)[0])

Regex and Parsing/Re.split().py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Re.split()
2+
# https://www.hackerrank.com/challenges/re-split/problem
3+
4+
import re
5+
for i in re.split('[, .]', input().strip()):
6+
if i.isdigit(): print(i)

0 commit comments

Comments
 (0)