Advertisement
CyberN00b

Untitled

Dec 4th, 2022
696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.41 KB | None | 0 0
  1. def main():
  2.     a = int(input())
  3.     arr = []
  4.     for i in range(a):
  5.         t = input().split(',')
  6.         count = 0
  7.         c = set()
  8.         for i in range(3):
  9.             for x in t[i]:
  10.                 if not x in c:
  11.                     count += 1
  12.                     c.add(x)
  13.         """c = [False] * 52
  14.        for i in range(3):
  15.            for x in t[i]:
  16.                if 'A' <= x <= 'Z':
  17.                    if not c[ord(x) - ord('A')]:
  18.                        count += 1
  19.                        c[ord(x) - ord('A')] = True
  20.                else:
  21.                    if not c[ord(x) - ord('a') + 26]:
  22.                        count += 1
  23.                        c[ord(x) - ord('a') + 26] = True"""
  24.         c2 = 0
  25.         for i in range(3, 5):
  26.             for x in t[i]:
  27.                 c2 += int(x)
  28.         c2 *= 64
  29.         c3 = ord(t[0][0]) - ord('A') + 1 if 'A' <= t[0][0] <= 'Z' else ord(t[0][0]) - ord('a') + 1
  30.         c3 *= 256
  31.         res = count + c2 + c3
  32.         tmp = 16 * 16
  33.         res %= tmp * 16
  34.         s = ""
  35.         while not tmp == 0:
  36.             i = res // tmp
  37.             res %= tmp
  38.             #print(i)
  39.             if i < 10:
  40.                 s += str(i)
  41.             else:
  42.                 s += chr(ord('A') + i % 10)
  43.             tmp //= 16
  44.         print(s, end=' ')
  45.  
  46. if __name__ == '__main__':
  47.     main()
  48. #abc,ABC,sda,23,01,2005
  49. #Volozh,Arcady,Yurievich,11,2,1964
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement