function solution(record) {
var answer = [];
const users={}
for(let i=record.length-1;i>=0;i--){
const recordSplit=record[i].split(" ");
const id=recordSplit[1];
const nick=recordSplit[2];
if(users[id]===undefined){
users[id]=nick;
}
}
for(let i=0;i<record.length;i++){
const recordSplit=record[i].split(" ");
const act=recordSplit[0];
const id=recordSplit[1];
if(act==="Enter"){
answer.push(`${users[id]}님이 들어왔습니다.`)
}
if(act==="Leave"){
answer.push(`${users[id]}님이 나갔습니다.`)
}
}
return answer;
}