summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-03-08 17:46:57 -0600
committerJesse Luehrs <doy@tozt.net>2013-03-08 17:46:57 -0600
commit32851cfec111dae489da71a11d9432e2c990eeab (patch)
tree0a6de72254548726661e12de94d44f3592fbe60b
parent58c835144bfb93b9904b496c35965cce5d351fc3 (diff)
downloadrosalind-32851cfec111dae489da71a11d9432e2c990eeab.tar.gz
rosalind-32851cfec111dae489da71a11d9432e2c990eeab.zip
another rust solution
-rw-r--r--HAMM.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/HAMM.rs b/HAMM.rs
new file mode 100644
index 0000000..5afb812
--- /dev/null
+++ b/HAMM.rs
@@ -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));
+}