<commit_before>package main

import "fmt"
import "strconv"

func main() {
	test := "aaabbbccbddd"
	result := compress(test)
	fmt.Println(result)
}

func compress(uncompressed string) string {
	prev := 0
	var letter string
	var next string
	var compressed string
	for index := 1; index < len(uncompressed); index++ {
		letter = string(uncompressed[index-1])
		next = string(uncompressed[index])
		if letter != next {
			count := index - prev
			compressed += string(letter)
			compressed += strconv.Itoa(count)
			prev = index
		}
	}
	compressed += string(letter)
	compressed += strconv.Itoa(len(uncompressed) - prev)
	return compressed
}<commit_msg>Use case statement to cover all cases<commit_after>package compress

import "bytes"
import "strconv"

func compress(uncompressed string) string {
	var buf bytes.Buffer

	switch len(uncompressed) {
	case 0:
		break
	case 1:
		buf.WriteByte(uncompressed[0])
		buf.WriteString("1")
	default:
		var prev byte
		var letter byte
		last := 0
		for i := 1; i < len(uncompressed); i++ {
			prev = uncompressed[i-1]
			letter = uncompressed[i]
			if letter != prev {
				buf.WriteByte(prev)
				buf.WriteString(strconv.Itoa(i - last))
				last = i
			}
		}
		buf.WriteByte(letter)
		buf.WriteString(strconv.Itoa(len(uncompressed) - last))
	}

	return buf.String()
}
{'fraction_non_alphanumeric': 0.12116564417177914, 'fraction_numerical': 0.007668711656441718, 'mean_word_length': 3.906015037593985, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2181292', 'n_tokens_mistral': 510, 'n_tokens_neox': 457, 'n_words': 117}