From af94575c4b5e91aaea7fafe6e79d3f4db7ac0648 Mon Sep 17 00:00:00 2001 From: huisuu Date: Mon, 26 Aug 2024 19:52:40 +0900 Subject: [PATCH] 54.py --- HSKIM/51to60/54.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 HSKIM/51to60/54.py diff --git a/HSKIM/51to60/54.py b/HSKIM/51to60/54.py new file mode 100644 index 0000000..d62bb57 --- /dev/null +++ b/HSKIM/51to60/54.py @@ -0,0 +1,15 @@ +def solution(s): + answer = '' + arr = [0 for _ in range(26)] + + for c in s: + arr[ord(c) - ord('a')] += 1 + + for i in range(26): + while arr[i] > 0: + answer += chr(i + ord('a')) + arr[i] -= 1 + + return answer + +print(solution("algorithm")) \ No newline at end of file