DNA/RNA pattern matching algorithm