#include #include #include #define MAX_INPUT_LENGTH 100 // Define the "Hack3r scr1pt" mapping 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; // Read the ingredient to be searched printf("Zadaj hladanu surovinu: "); fgets(ingredient, MAX_INPUT_LENGTH, stdin); ingredient[strcspn(ingredient, "\n")] = 0; // Remove newline character printf("Zadaj jedalny listok:\n"); // Print the prompt // Read the menu items while (1) { fgets(menu_item, MAX_INPUT_LENGTH, stdin); if (feof(stdin) || strlen(menu_item) == 1) { break; } menu_item[strcspn(menu_item, "\n")] = 0; // Remove newline character // Apply the "Hack3r scr1pt" mapping to the name 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; // Search for the ingredient in the name if (strstr(name_hack3r, ingredient) != NULL) { printf("%s\n", menu_item); count++; } } // Display the count of successful searches printf("Nacitanych %d poloziek.\n", count); return 0; }