function solution(record) {
var answer = [];
let obj={};
for (let i=0;i<record.length;i++){
let [state, id, nick]=record[i].split(' ');
if(state==='Enter'){
if(id in obj){
obj[id]=nick;
}else{
obj[id]=nick;
}
}else if(state==='Change'){
obj[id]=nick;
}
}
for(let i=0;i<record.length;i++){
let [state, id, nick]=record[i].split(' ');
if(state==='Enter'){
answer.push(obj[id]+'님이 '+'들어왔습니다.')
}else if(state==='Leave'){
answer.push(obj[id]+'님이 '+'나갔습니다.')
}
}
return answer;
}