It appears that your browser has JavaScript disabled. Rosalind requires your browser to be JavaScript enabled.

We defined a mismatch in “Compute the Hamming Distance Between Two Strings”. We now generalize “Find the Most Frequent Words in a String” to incorporate mismatches as well.

Given strings Text and Pattern as well as an integer d, we define Count d (Text, Pattern) as the total number of occurrences of Pattern in Text with at most d mismatches. For example, Count 1 (AA C AAGCTGA T AAA C ATTTAAA G AG, AAAAA) = 4 because AAAAA appears four times in this string with at most one mismatch: AA C AA, A T AAA, AAA C A, and AAA G A. Note that two of these occurrences overlap.

A most frequent k-mer with up to d mismatches in Text is simply a string Pattern maximizing Count d (Text, Pattern) among all k-mers. Note that Pattern does not need to actually appear as a substring of Text; for example, AAAAA is the most frequent 5-mer with 1 mismatch in AACAAGCTGATAAACATTTAAAGAG, even though AAAAA does not appear exactly in this string. Keep this in mind while solving the following problem.

Frequent Words with Mismatches Problem

Find the most frequent k-mers with mismatches in a string.

Given: A string Text as well as integers k and d.

Return: All most frequent k-mers with up to d mismatches in Text.

Sample Dataset

ACGTTGCATGTCGCATGATGCATGAGAGCT 4 1

Sample Output

GATG ATGC ATGT

Extra Datasets

Click for an extra dataset

Click for debug datasets