import Foundation
let str = "Swift Programming Language"
let stringWithoutSpaces = str.filter { !$0.isWhitespace }
let lengthWithoutSpaces = stringWithoutSpaces.count
print("Length without spaces: \(lengthWithoutSpaces)")
/*
run:
Length without spaces: 24
*/