#include #include #include #include #define MAX_LENGTH 100 void decode_hacker_script(const char *input, char *output) { int j = 0; for (int i = 0; input[i]; i++) { char c = tolower(input[i]); if (c == 'o' || c == '0') output[j++] = 'o'; else if (c == 'i' || c == '1') output[j++] = 'i'; else if (c == 'z' || c == '2') output[j++] = 'z'; else if (c == 'e' || c == '3') output[j++] = 'e'; else if (c == 'a' || c == '4') output[j++] = 'a'; else if (c == 's' || c == '5') output[j++] = 's'; else if (c == 'b' || c == '6' || c == '8') output[j++] = 'b'; else if (c == 't' || c == '7') output[j++] = 't'; else if (c == 'q' || c == '9') output[j++] = 'q'; else output[j++] = c; } output[j] = '\0'; } int main() { char search_item[MAX_LENGTH], menu_item[MAX_LENGTH], price[MAX_LENGTH]; char decoded_item[MAX_LENGTH], decoded_search[MAX_LENGTH]; int count = 0; printf("Zadaj hladanu surovinu:\n"); scanf("%s", search_item); decode_hacker_script(search_item, decoded_search); while (getchar() != '\n'); printf("Zadaj jedalny listok:\n"); while (1) { if (fgets(menu_item, sizeof(menu_item), stdin) == NULL || strlen(menu_item) == 0) { break; } menu_item[strcspn(menu_item, "\n")] = 0; if (fgets(price, sizeof(price), stdin) == NULL || strlen(price) == 0) { break; } price[strcspn(price, "\n")] = 0; decode_hacker_script(menu_item, decoded_item); count++; double price_value = atof(price); if (strstr(decoded_item, decoded_search) != NULL) { printf("%s\n%.2f\n", menu_item, price_value); } } printf("Nacitanych %d poloziek.\n", count); return 0; }