diff --git a/TaskD01/description.txt b/TaskD01/description.txt new file mode 100644 index 0000000..f2365af --- /dev/null +++ b/TaskD01/description.txt @@ -0,0 +1,5 @@ +Write a program to find lines containing the word "Hamlet". +Do use regular expressions. + +POINTS: 1 +DEADLINE: 2023-11-26 23:59:59 \ No newline at end of file diff --git a/TaskD01/run.py b/TaskD01/run.py new file mode 100644 index 0000000..bdcf3a7 --- /dev/null +++ b/TaskD01/run.py @@ -0,0 +1,13 @@ +import re +import sys + +found_lines = [] + + +for line in sys.stdin: + if re.search(r'\bHamlet\b', line): + found_lines.append(line.strip()) + + +if found_lines: + print('\n'.join(found_lines), end='') \ No newline at end of file diff --git a/TaskD01/simple.exp b/TaskD01/simple.exp new file mode 100644 index 0000000..0064e87 --- /dev/null +++ b/TaskD01/simple.exp @@ -0,0 +1,2 @@ +Here comes Hamlet +Hamlet Hamlet again \ No newline at end of file diff --git a/TaskD01/simple.in b/TaskD01/simple.in new file mode 100644 index 0000000..24e23e3 --- /dev/null +++ b/TaskD01/simple.in @@ -0,0 +1,3 @@ +Here comes Hamlet +ABC +Hamlet Hamlet again \ No newline at end of file diff --git a/TaskD01/simple.out b/TaskD01/simple.out new file mode 100644 index 0000000..0064e87 --- /dev/null +++ b/TaskD01/simple.out @@ -0,0 +1,2 @@ +Here comes Hamlet +Hamlet Hamlet again \ No newline at end of file