#include #include #include char convert_to_normal(char ch) { switch (ch) { case '0': return 'o'; case '1': return 'i'; case '2': return 'z'; case '3': return 'e'; case '4': return 'a'; case '5': return 's'; case '6': return 'b'; case '7': return 't'; case '8': return 'b'; case '9': return 'q'; default: return tolower(ch); } } int contains_substring(char *food_name, char *ingredient) { int len_food = strlen(food_name); int len_ing = strlen(ingredient); int i, j; for (i = 0; i <= len_food - len_ing; i++) { int found = 1; for (j = 0; j < len_ing; j++) { if (convert_to_normal(food_name[i + j]) != convert_to_normal(ingredient[j])) { found = 0; break; } } if (found) return 1; } return 0; } int main() { char ingredient[100]; char food_name[100]; char price[20]; int count = 0; printf("Zadaj hladanu surovinu: "); scanf("%s", ingredient); printf("Zadaj jedalny listok:\n"); while (scanf("%s", food_name) != EOF) { if (scanf("%s", price) == EOF) { break; } if (contains_substring(food_name, ingredient)) { printf("%s\n%s\n", food_name, price); } count++; } printf("Nacitanych %d poloziek.\n", count); return 0; }