func (d DNA) Counts() (Histogram, error) {
	h := Histogram{'A': 0, 'C': 0, 'G': 0, 'T': 0}
	for _, nucleotide := range d {
		if _, ok := h[nucleotide]; ok {
			h[nucleotide]++
		} else {
			return Histogram{}, fmt.Errorf("%q is not a valid nucleotide", nucleotide)
		}
	}
	return h, nil
}
// Counts generates a histogram of valid nucleotides in the given DNA.
// Returns an error if d contains an invalid nucleotide.
Counts generates a histogram of valid nucleotides in the given DNA.
Returns an error if d contains an invalid nucleotide.
// Counts generates a histogram of valid nucleotides in the given DNA . // Returns an error if d contains an invalid nucleotide .
func (d DNA) Counts() (Histogram, error) {
	h := Histogram{'A': 0, 'C': 0, 'G': 0, 'T': 0}
	for _, nucleotide := range d {
		if _, ok := h[nucleotide]; ok {
			h[nucleotide]++
		} else {
			return Histogram{}, fmt.Errorf("%q is not a valid nucleotide", nucleotide)
		}
	}
	return h, nil
}
func ( d DNA ) Counts ( ) ( Histogram , error ) { h := Histogram { 'A' : 0 , 'C' : 0 , 'G' : 0 , 'T' : 0 } for _ , nucleotide := range d { if _ , ok := h [ nucleotide ] ; ok { h [ nucleotide ] ++ } else { return Histogram { } , fmt . Errorf ( " " , nucleotide ) } } return h , nil }
Counts generates a histogram of valid nucleotides in the given DNA.
Counts generates a histogram of valid nucleotides in the given DNA .