import java.util.*;
class Solution {
public String solution(String s) {
String answer = "";
HashMap<Character, Integer> hM = new HashMap<>();
for (Character x : s.toCharArray()) {
hM.put(x, hM.getOrDefault(x, 0) + 1);
}
List<Character> list = new ArrayList(hM.keySet());
Collections.sort(list);
for (Character key : list) {
if (hM.get(key) == 1) {
answer += key;
}
}
return answer;
}
}
import java.util.*;
class Solution {
public String solution(String s) {
HashMap<Character, Integer> sH = new HashMap<>();
for (char x : s.toCharArray()) {
sH.put(x, sH.getOrDefault(x, 0) + 1);
}
StringBuilder sb = new StringBuilder();
for (char key : sH.keySet()) {
if (sH.get(key) == 1) sb.append(key);
}
String tmp = sb.toString();
char[] answer = tmp.toCharArray();
Arrays.sort(answer);
return String.valueOf(answer);
}
}
https://school.programmers.co.kr/learn/courses/30/lessons/120896