From 203cef8cca5f2529f5bdd47c8245b90f973d8abf Mon Sep 17 00:00:00 2001 From: Eryk Miszczuk Date: Tue, 5 Nov 2019 15:03:27 +0100 Subject: [PATCH] Task X04 --- TaskX04/run | 2 ++ TaskX04/run.py | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 TaskX04/run create mode 100644 TaskX04/run.py diff --git a/TaskX04/run b/TaskX04/run new file mode 100644 index 0000000..34fba43 --- /dev/null +++ b/TaskX04/run @@ -0,0 +1,2 @@ +#!/bin/bash +python TaskX04/run.py "$@" diff --git a/TaskX04/run.py b/TaskX04/run.py new file mode 100644 index 0000000..49ab8fe --- /dev/null +++ b/TaskX04/run.py @@ -0,0 +1,19 @@ +import sys +import re + +commentPattern = re.compile('^#.*') +automataStepPattern = re.compile(r'[0-9]+ [0-9]+ [A-Za-z]+( ([0-9]+\.[0-9]+)|)') + +#print("First argument: ", sys.argv[0]) + +steps = 0 + +for line in sys.stdin: + line = line.replace('\n', '') + if commentPattern.match(line): + continue + if automataStepPattern.match(line): + steps += 1 + +print(steps) +