diff --git a/TaskD03/description.txt b/TaskD03/description.txt new file mode 100644 index 0000000..114f376 --- /dev/null +++ b/TaskD03/description.txt @@ -0,0 +1,6 @@ +Write a program to find lines containing date from 1900 to 1999 in format '19XX r.' no matter what on the left or right of the expression. +Note that part ' r.' is obligatory. +Do use regular expressions. + +POINTS: 1 +DEADLINE: 2023-11-26 23:59:59 \ No newline at end of file diff --git a/TaskD03/run.py b/TaskD03/run.py new file mode 100644 index 0000000..05f6da4 --- /dev/null +++ b/TaskD03/run.py @@ -0,0 +1,14 @@ +import re +import sys + + +found_lines = [] + +for line in sys.stdin: + if re.search(r'\b19\d{2}\s*r\.\b|\b\W19\d{2}\s*r\.\b|\b19\d{2}\s*r\.\W', line, flags=re.IGNORECASE): + found_lines.append(line.strip()) + + +if found_lines: + print('\n'.join(found_lines), end='') + diff --git a/TaskD03/simple.exp b/TaskD03/simple.exp new file mode 100644 index 0000000..175c58f --- /dev/null +++ b/TaskD03/simple.exp @@ -0,0 +1,3 @@ +Kiedys byl 1934 r. +Kiedys byl 1934 r.fsdfsdfsdf +1934 r. to jakas data \ No newline at end of file diff --git a/TaskD03/simple.in b/TaskD03/simple.in new file mode 100644 index 0000000..e3a93b7 --- /dev/null +++ b/TaskD03/simple.in @@ -0,0 +1,5 @@ +Kiedys byl 1934 r. +Kiedys byl 1934 r.fsdfsdfsdf +Kiedys byl 1935 rok +1934 r. to jakas data +1934 to tez jakas data \ No newline at end of file diff --git a/TaskD03/simple.out b/TaskD03/simple.out new file mode 100644 index 0000000..175c58f --- /dev/null +++ b/TaskD03/simple.out @@ -0,0 +1,3 @@ +Kiedys byl 1934 r. +Kiedys byl 1934 r.fsdfsdfsdf +1934 r. to jakas data \ No newline at end of file