내 풀이
function solution(survey, choices) {
var answer = '';
const type = {'R':0,'T':0,'C':0,'F':0,'J':0,'M':0,'A':0,'N':0}
for(let i=0;i<survey.length;i++){
if(choices[i]>4){
type[survey[i][1]] += choices[i]-4
}else if(choices[i]<4){
type[survey[i][0]] += choices[i]==2?choices[i]: (choices[i]===1? 3:1)
}
}
if(type['R']<type['T']){
answer+='T'
}else{
answer+='R'
}
if(type['C']<type['F']){
answer+='F'
}else{
answer+='C'
}
if (type['J']<type['M']) {
answer += 'M'
} else {
answer += 'J'
}
if (type['A']<type['N']) {
answer += 'N'
} else {
answer += 'A'
}
return answer
}