<commit_before>use itertools::Itertools;

fn day10(input: &str) -> (usize, usize) {

    let mut i = 1;
    let mut next = String::from(input);
    let mut part1 = 0;
    let mut part2 = 0;
    loop {
        next = next.chars()
                   .group_by(|&x| x)
                   .map(|(n, l)| {
                       let mut s = l.len().to_string();
                       s.push(n);
                       s
                   })
                   .collect::<String>();
        if i == 40 {
            part1 = next.len();
        }<commit_msg>make rust day10 faster<commit_after>use itertools::Itertools;

fn day10(input: &str) -> (usize, usize) {
    let mut i = 1;
    let mut next = String::from(input);
    let mut part1 = 0;
    let mut part2 = 0;
    loop {
        let mut buf = String::new();
        for (number, list) in next.chars().group_by(|&x| x) {
            buf.push_str(&list.len().to_string());
            buf.push(number);
        }
        next = buf;
        if i == 40 {
            part1 = next.len();
        }
{'fraction_non_alphanumeric': 0.1462715105162524, 'fraction_numerical': 0.021032504780114723, 'mean_word_length': 1.3687782805429864, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7084438', 'n_tokens_mistral': 348, 'n_tokens_neox': 330, 'n_words': 88}