func solution(_ cacheSize:Int, _ cities:[String]) -> Int {
var time = 0
var cache = [String]()
var cities = cities.map { $0.lowercased() }
for city in cities {
if cache.contains(city) {
time += 1
cache.remove(at: cache.firstIndex(of: city)!)
cache.append(city)
} else {
time += 5
cache.append(city)
if cache.count > cacheSize {
cache.removeFirst()
}
}
}
return time
}