-
[Swift] ๋ฐฑ์ค 1181 ๋จ์ด ์ ๋ ฌ (String)๐ป Algorithm/Swift 2023. 1. 31. 22:30
๐ ํ์ด
๐ฌ Code
import Foundation var n = Int(readLine()!)! var arr = [String]() for _ in 0..<n { let word = readLine()! arr.append(word) } arr = Array(Set(arr)) arr.sort { if $0.count == $1.count { return $0 < $1 } return $0.count < $1.count } arr.forEach{ print($0) }
'๐ป Algorithm > Swift' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Swift] ๋ฐฑ์ค 1260 DFS์ BFS (Graph Traversal) (0) 2023.01.31 [Swift] ๋ฐฑ์ค 14490 ๋ฐฑ๋์ด (์ต๋๊ณต์ฝ์ GCM ๋ฌธ์ ) (0) 2023.01.31 [Swift] ๋ฐฑ์ค 2941 ํฌ๋ก์ํฐ์ ์ํ๋ฒณ (String) (0) 2023.01.31 [Swift] ๋ฐฑ์ค 1427 ์ํธ์ธ์ฌ์ด๋ (String) (0) 2023.01.31 [Swift] ๋ฐฑ์ค 4659 ๋น๋ฐ๋ฒํธ ๋ฐ์ํ๊ธฐ (String) (0) 2023.01.31