<commit_before>#include <stdio.h>
#include <string.h>

void create_letter_distribution_diagram();

struct Diagram_struct{
	char character;
	int occurences;
}diagram[26];

int main(){
	
	create_letter_distribution_diagram();
	
	return 0;

}

void create_letter_distribution_diagram(){
	int i, l, temp;
	char ch, str[200], tempchar; 
	for(i = 0; i < 26; i++){
		diagram[i].character = 'a' + i;
		diagram[i].occurences = 0;
	}
	for(i=0; 1; i++){
		ch=getchar();
		
		if(ch == '\n'){
			break;
		}
		else{
			str[i] = ch;
		}
	}
	
	for(i=0; i<strlen(str); i++){
		if(str[i] >= 'A' && str[i] <= 'Z'){
			str[i] -= 'A' - 'a';
		}
		if(str[i] >= 'a' && str[i] <= 'z'){
			diagram[(str[i] - 'a')].occurences++;
		}
	}
	
	for (i = 0; i < (26 - 1); i++){
		for (l = 0; l < 26 - i - 1; l++) {
			if(diagram[l].occurences < diagram[l+1].occurences){
				temp=diagram[l].occurences;
				tempchar=diagram[l].character;
				diagram[l].occurences = diagram[l+1].occurences;
				diagram[l+1].occurences = temp;
				diagram[l].character   = diagram[l+1].character;
				diagram[l+1].character = tempchar;
			}
			else if(diagram[l].character < diagram[l+1].character && diagram[l].occurences == diagram[l+1].occurences){
				temp=diagram[l].occurences;
				tempchar=diagram[l].character;
				diagram[l].occurences = diagram[l+1].occurences;
				diagram[l+1].occurences = temp;
				diagram[l].character   = diagram[l+1].character;
				diagram[l+1].character = tempchar;
			}
		}
	}
	
	for(i=0; i<26; i++){
		printf("%c: %d\n", diagram[i].character, diagram[i].occurences);
	}
}
<commit_msg>Slight improvement to task3 and add EOF instead of \n to task 3 reading<commit_after>#include <stdio.h>
#include <string.h>

void create_letter_distribution_diagram();

struct Diagram_struct{
	char character;
	int occurences;
}diagram[26];

int main(){
	
	create_letter_distribution_diagram();
	
	return 0;

}

void create_letter_distribution_diagram(){
	int i, l, temp;
	char ch, str[200], tempchar; 
	
	for(i = 0; i < 26; i++){
		diagram[i].character = 'a' + i;
		diagram[i].occurences = 0;
	}
	
	for(i=0; 1; i++){
		ch=getchar();
		
		if(ch == EOF){
			break;
		}
		else{
			str[i] = ch;
		}
	}
	
	for(i=0; i<strlen(str); i++){
		if(str[i] >= 'A' && str[i] <= 'Z'){
			str[i] -= 'A' - 'a';
		}
		if(str[i] >= 'a' && str[i] <= 'z'){
			diagram[(str[i] - 'a')].occurences++;
		}
	}
	
	for (i = 0; i < (26 - 1); i++){
		for (l = 0; l < 26 - i - 1; l++) {
			if(diagram[l].occurences < diagram[l+1].occurences){
				temp = diagram[l].occurences;
				tempchar = diagram[l].character;
				diagram[l].occurences = diagram[l+1].occurences;
				diagram[l+1].occurences = temp;
				diagram[l].character = diagram[l+1].character;
				diagram[l+1].character = tempchar;
			}
			else if(diagram[l].character < diagram[l+1].character && diagram[l].occurences == diagram[l+1].occurences){ /*Sorts the rest alphabetically if they have equal occurences*/
				temp = diagram[l].occurences;
				tempchar = diagram[l].character;
				diagram[l].occurences = diagram[l+1].occurences;
				diagram[l+1].occurences = temp;
				diagram[l].character = diagram[l+1].character;
				diagram[l+1].character = tempchar;
			}
		}
	}
	
	for(i=0; i<26; i++){
		printf("%c: %d\n", diagram[i].character, diagram[i].occurences);
	}
}

{'fraction_non_alphanumeric': 0.20312022025084123, 'fraction_numerical': 0.022025084123585194, 'mean_word_length': 3.5991561181434597, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 11, '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': '7524682', 'n_tokens_mistral': 1554, 'n_tokens_neox': 1349, 'n_words': 252}