Last active
August 29, 2015 14:06
-
-
Save otto-schnurr/a0d2b865c289154eaf31 to your computer and use it in GitHub Desktop.
A Swift solution for http://rosalind.info/problems/dna/.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/xcrun swift -F . | |
// FileInput module from https://github.com/otto-schnurr/FileInput-swift | |
import FileInput | |
let dna = input().nextLine()! | |
var count: [Character: Int] = ["A": 0, "C": 0, "G": 0, "T": 0]; | |
for base in dna { count[base]? += 1 } | |
println(" ".join(map("ACGT") { toString(count[$0]!) })) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment