# 풀이
import Foundation
func solution(_ players:[String], _ callings:[String]) -> [String] {
var ranking: [String: Int] = [:]
var players = players
for (rank, player) in players.enumerated() {
ranking[player] = rank
}
// 1등이 불리면 오버플로우니까 제외됨
for callee in callings {
let front = players[ranking[callee]! - 1]
players[ranking[callee]! - 1] = callee
players[ranking[callee]!] = front
ranking[callee]! -= 1
ranking[front]! += 1
}
return players
}