You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
275 B

import Foundation
let contents = try! String(contentsOfFile: "input.txt")
var lines = [Int]()
for l in contents.split(separator:"\n") {
lines.append(Int(l)!)
}
var increases = 0
for i in 1..<lines.count {
if lines[i] > lines[i-1] {
increases += 1
}
}
print(increases)