#include #include #include #define MAX_INPUT_LENGTH 100 char hack3r_script_mapping[][2] = { {'0', 'o'}, {'1', 'i'}, {'2', 'z'}, {'3', 'e'}, {'4', 'a'}, {'5', 's'}, {'6', 'b'}, {'7', 't'}, {'8', 'b'}, {'9', 'q'} }; int main() { char ingredient[MAX_INPUT_LENGTH]; char menu_item[MAX_INPUT_LENGTH]; int count = 0; printf("Zadaj hladanu surovinu: "); fgets(ingredient, MAX_INPUT_LENGTH, stdin); ingredient[strcspn(ingredient, "\n")] = 0; printf("Zadaj jedalny listok:\n"); while (1) { fgets(menu_item, MAX_INPUT_LENGTH, stdin); if (feof(stdin) || strlen(menu_item) == 1) { break; } menu_item[strcspn(menu_item, "\n")] = 0; char name_hack3r[MAX_INPUT_LENGTH]; int j = 0; for (int i = 0; menu_item[i]; i++) { int found = 0; for (int k = 0; k < 10; k++) { if (menu_item[i] == hack3r_script_mapping[k][0]) { name_hack3r[j++] = hack3r_script_mapping[k][1]; found = 1; break; } } if (!found) { name_hack3r[j++] = tolower(menu_item[i]); } } name_hack3r[j] = 0; if (strstr(name_hack3r, ingredient) != NULL) { printf("%s\n", menu_item); count++; } } printf("Nacitanych %d poloziek.\n", count); return 0; }