문제설명 알고리즘 1. 알파벳과 그 인덱스를 map 에 저장한다 2. map에서 해당 key를 조회하고 있으면 그 value와 문자열을 순회하는 index값을 빼어 결과값에 저장 3. key가 없는 경우 결과값에 -1 저장, 그리고 map에 key값과 현재 index저장 코드 #include #include #include using namespace std; vector solution(string s) { vector answer; map m; for(int i=0; i< s.size(); i++){ char temp = s[i]; if(m.count(temp)){//해당 알파벳이 있으면 answer.push_back(i-m[temp]); //제일 가까운 위치 구해서 거리 저장 m[temp] = i;..