aa
This commit is contained in:
parent
f3f60d509d
commit
12235c8914
@ -6,23 +6,20 @@
|
|||||||
|
|
||||||
// meni cisla na znaky a aj velke na male
|
// meni cisla na znaky a aj velke na male
|
||||||
void normalize(char *z) {
|
void normalize(char *z) {
|
||||||
char cis[] = "013456789";
|
char cis[] = "0123456789";
|
||||||
char pis[] = "oieasgtbq";
|
char pis[] = "oizeasgtbq";
|
||||||
|
|
||||||
for (int i = 0; z[i]; i++) {
|
for (int i = 0; z[i]; i++) {
|
||||||
char x = tolower(z[i]);
|
char x = tolower((unsigned char)z[i]);
|
||||||
|
|
||||||
|
|
||||||
int found = 0;
|
int found = 0;
|
||||||
for (int j = 0; j < 9; j++) {
|
for (int j = 0; j < 10; j++) {
|
||||||
if (x == cis[j]) {
|
if (x == cis[j]) {
|
||||||
z[i] = pis[j];
|
z[i] = pis[j];
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//na male pismeno
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
z[i] = x;
|
z[i] = x;
|
||||||
}
|
}
|
||||||
@ -31,7 +28,6 @@ void normalize(char *z) {
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char h[LINE_SIZE];
|
char h[LINE_SIZE];
|
||||||
char line[LINE_SIZE];
|
|
||||||
char j[LINE_SIZE];
|
char j[LINE_SIZE];
|
||||||
char price[LINE_SIZE];
|
char price[LINE_SIZE];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -46,15 +42,19 @@ int main() {
|
|||||||
if (!fgets(j, LINE_SIZE, stdin)) break;
|
if (!fgets(j, LINE_SIZE, stdin)) break;
|
||||||
j[strcspn(j, "\n")] = 0;
|
j[strcspn(j, "\n")] = 0;
|
||||||
if (strlen(j) == 0) break;
|
if (strlen(j) == 0) break;
|
||||||
|
|
||||||
if (!fgets(price, LINE_SIZE, stdin)) break;
|
if (!fgets(price, LINE_SIZE, stdin)) break;
|
||||||
price[strcspn(price, "\n")] = 0;
|
price[strcspn(price, "\n")] = 0;
|
||||||
|
|
||||||
|
count++; // počítame všetky položky
|
||||||
|
|
||||||
char norm_dish[LINE_SIZE];
|
char norm_dish[LINE_SIZE];
|
||||||
strcpy(norm_dish, j);
|
strcpy(norm_dish, j);
|
||||||
normalize(norm_dish);
|
normalize(norm_dish);
|
||||||
|
|
||||||
if (strstr(norm_dish, h) != NULL) {
|
if (strstr(norm_dish, h) != NULL) {
|
||||||
printf("%s\n", j);
|
printf("%s\n", j);
|
||||||
printf("%s\n", price);
|
printf("%s\n", price);
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user