summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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));
+}