diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-03-08 17:46:57 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-03-08 17:46:57 -0600 |
commit | 32851cfec111dae489da71a11d9432e2c990eeab (patch) | |
tree | 0a6de72254548726661e12de94d44f3592fbe60b | |
parent | 58c835144bfb93b9904b496c35965cce5d351fc3 (diff) | |
download | rosalind-32851cfec111dae489da71a11d9432e2c990eeab.tar.gz rosalind-32851cfec111dae489da71a11d9432e2c990eeab.zip |
another rust solution
-rw-r--r-- | HAMM.rs | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -0,0 +1,16 @@ +use io::{stdin,println,ReaderUtil}; + +fn main() { + let dna1 = stdin().read_line(); + let dna2 = stdin().read_line(); + assert str::len(dna1) == str::len(dna2); + + let mut hamming = 0; + for str::each_chari(dna1) |i, ch| { + if ch != str::char_at(dna2, i) { + hamming += 1; + } + } + + println(fmt!("%d", hamming)); +} |