TextConverter exercise ported to Swift