2022-11-18 10:45:54 +00:00
|
|
|
def main():
|
|
|
|
with open('names.txt', 'r') as f:
|
|
|
|
names = f.read().split('\n')
|
2022-11-28 18:01:03 +00:00
|
|
|
namesDict = {surname: set([name.split(' ')[0] for name in names[1:] if surname in name])
|
|
|
|
for surname in set([name.split(' ')[-1] for name in names[1:] if name != ''])}
|
2022-11-18 10:45:54 +00:00
|
|
|
|
|
|
|
printNames(namesDict)
|
|
|
|
|
|
|
|
|
|
|
|
def printNames(namesDict):
|
|
|
|
for surname in namesDict:
|
|
|
|
print(f"{surname} : {namesDict[surname]}")
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|