https://programmers.co.kr/learn/courses/30/lessons/17680#
from collections import deque
def solution(cacheSize, cities):
answer = 0
q = []
cache = deque(q)
if cacheSize == 0:
return len(cities) * 5
for city in cities:
city = city.lower()
if city not in cache:
if len(cache) == cacheSize:
cache.popleft()
cache.append(city)
else:
cache.append(city)
answer +=5
elif city in cache:
idx=list(cache).index(city)
del cache[idx]
cache.append(city)
answer +=1
return answer