use std::collections::HashMap;

fn nucleotide_counts(nucleotides: &str) -> HashMap<char, usize> {
    let mut nucleotide = HashMap::new();
    for n in nucleotides.chars() {
        let counter = nucleotide.entry(n)    // gets the given key's corrosponding entry in the map for in-place manipulation
        .or_insert(0);                      // ..or insert 0 if its not present already 
        *counter += 1;                       // Now increment the entry, so it's 1 for all new keys or plus one for all other.
    }
    nucleotide
}

fn count(nucleotide: char) -> usize {
    let map = nucleotide_counts("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC");
    match map.get(&nucleotide) {
        Some(x) => *x,
        _ => 0, 
    }
}


fn main() {
    println!("{:?}", count(''));
}