I have this program with a class DNA. The program counts the most frequent k-mer in a string. So, it is looking for the most common substring in a string with a length of k. 

An example would be creating a dna1 object with a string of AACCAATCCG. The count k-mer method will look for a subtring with a length of k and output the most common answer. So, if we set k = 1 then 'A' and 'C' will be the most occurrence in the string because it appears four times. See example below: 

```
 dna1 = DNA.new('AACCAATCCG')
=> AACCAATCCG
>> dna1.count_kmer(1)
=> [#<Set: {"A", "C"}>, 4]
>> dna1.count_kmer(2)
=> [#<Set: {"AA", "CC"}>, 2]

```

Here is my DNA class : 

```
   class DNA
      def initialize (nucleotide)
        @nucleotide = nucleotide
      end
      def length
        @nucleotide.length
      end   
      protected
 attr_reader :nucleotide
end

```

Here is my count kmer method that I am trying to implement:

```
# I have k as my only parameter because I want to pass the nucleotide string in the method
def count_kmer(k)

# I created an array as it seems like a good way to split up the nucleotide string.
  counts = []

  #this tries to count how many kmers of length k there are
  num_kmers = self.nucleotide.length- k + 1

  #this should try and look over the kmer start positions
  for i in num_kmers

    #Slice the string, so that way we can get the kmer
    kmer = self.nucleotide.split('')
  end

  #add kmer if its not present
  if !kmer = counts
    counts[kmer] = 0

    #increment the count for kmer
    counts[kmer] +=1 
  end

  #return the final count
return counts
end

#end dna class
end

```

I'm not sure where my method went wrong.