ysu-acm solves and icpc A & B

This commit is contained in:
Xevion
2019-08-24 18:03:31 -05:00
parent 63afb03484
commit 3297bcd237
16 changed files with 156 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
THIS IS THE ('FIRST') LINE IN THE SAMPLE FILE!!!!
ANY CHARACTERS CAN BE IN THE FILE%^$*.(")...
('THIS PART OF THE FILE SHOULD NOT BE CHANGED')
'(BUT THIS PART SHOULD 123........('...............
NUMBERS, 1234567890, ARE OK. OK?

View File

@@ -0,0 +1,14 @@
import re, string, os, sys
pattern = r'([\s\S]*)(\(.*\))([\s\S]*)'
def main():
path = os.path.join(sys.path[0], 'input')
mapping = str.maketrans(string.ascii_uppercase, string.ascii_uppercase[::-1])
print(string.ascii_uppercase)
print(string.ascii_uppercase[::-1])
data = open(path, 'r').read()
matches = re.findall(pattern, data)[0]
result = ''
for match in matches:
result += match if match.startswith('(') else match.translate(mapping)
print(result)