Closed feldblume5263 closed 2 years ago
let inputs = readLine()!.map {
return String($0).uppercased()
}
var dict = [String : Int]()
for input in inputs {
if dict[input] != nil {
dict[input]! += 1
} else {
dict[input] = 1
}
}
let sorted = dict.sorted { $0.value > $1.value }
if sorted.count > 1 {
if sorted[0].value == sorted[1].value {
print("?")
} else {
print(sorted[0].key)
}
} else {
print(sorted[0].key)
}
print(readLine()!.split(separator: " ").count)
let inputs = readLine()!.split(separator: " ").map {String($0)}
let a = Int(String(inputs[0].reversed()))!
let b = Int(String(inputs[1].reversed()))!
print(a > b ? "\(a)" : "\(b)")
let inputs = readLine()!.map{String($0)}
let a = ["ABC", "DEF", "GHI", "JKL", "MNO", "PQRS", "TUV", "WXYZ"]
var sum = 0
for input in inputs {
sum += (a.firstIndex{$0.contains(Character(input))}! + 3)
}
print(sum)
import Foundation
var inputs = readLine()!
let als = ["c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z="]
for al in als {
inputs = inputs.replacingOccurrences(of: al, with: ".")
}
print(inputs.count)
let n = Int(readLine()!)!
var s = 0
for _ in 0..<n {
let inputs = readLine()!//.map{String($0)}
var flag = true
for input in inputs {
let iter = (inputs.components(separatedBy: String(input)).count - 1)
var new = ""
for _ in 0..<iter {
new += String(input)
}
if !inputs.contains(new) {
flag = false
}
}
if flag {
s += 1
}
}
print(s)
잘해보장~!!