Advertisement
Merevoli

Untitled

Apr 29th, 2022
727
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = int(input())
  2. files = [input() for _ in range(n)]
  3.  
  4. memo = set()
  5. for file in files:
  6.     k = 0
  7.     current_file = file
  8.     while file in memo:
  9.         k += 1
  10.         file = f"{current_file}({k})"
  11.        
  12.     memo.add(file)
  13.     print(file)
Advertisement
RAW Paste Data Copied
Advertisement