학생 번호

last update: 2021.09.08.WED

1235 학생 번호, Silver 4

Memory 29452KB, Time 80ms


import sys

n = int(input())
nums = [sys.stdin.readline().strip() for _ in range(n)]

length = len(nums[0])
count = length - 1

    
while count > -1:
    new_arr = []
    for num in nums:
        new_arr.append(num[count:])
    if len(new_arr) != len(set(new_arr)):
        count -= 1
    elif len(new_arr) == len(set(new_arr)) and count != length:
        print(length-count)
        break
    elif len(new_arr) == len(set(new_arr)) and count == length:
        print(length)
        break