-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path모음 사전.swift
More file actions
38 lines (33 loc) · 903 Bytes
/
모음 사전.swift
File metadata and controls
38 lines (33 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// 모음 사전.swift
//
//
// Created by chihoooon on 2022/02/06.
//
import Foundation
func solution(_ word:String) -> Int {
let words = ["A", "E", "I", "O", "U"]
var dict: [String] = []
for i in 0..<5 {
dict.append(words[i])
for j in 0..<5 {
dict.append(words[i] + words[j])
for k in 0..<5 {
dict.append(words[i] + words[j] + words[k])
for l in 0..<5 {
dict.append(words[i] + words[j] + words[k] + words[l])
for m in 0..<5 {
dict.append(words[i] + words[j] + words[k] + words[l] + words[m])
}
}
}
}
}
dict.sort()
for (index, value) in dict.enumerated() {
if value == word {
return index + 1
}
}
return 0
}