Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- #include <math.h>
- int main(int argc, char *argv[]) {
- FILE *i1 = fopen(argv[1], "r");
- FILE *i2 = fopen(argv[2], "r");
- FILE *o = fopen(argv[3], "w");
- if(i1 == NULL || i2 == NULL) {
- printf("GRESHKA");
- return 0;
- }
- int bukvi1[26], bukvi2[26];
- char niza1[1001], niza2[1001];
- while(fgets(niza1, 500, i1)) {
- fgets(niza2, 500, i2);
- for(int i = 0; i < 26; i++) {
- bukvi1[i] = 0;
- bukvi2[i] = 0;
- }
- for(int i = 0; i < strlen(niza1); i++) {
- if(isalpha(niza1[i])) {
- niza1[i] = tolower(niza1[i]);
- bukvi1[niza1[i] - 'a'] = 1;
- }
- }
- for(int i = 0; i < strlen(niza2); i++) {
- if(isalpha(niza2[i])) {
- niza2[i] = tolower(niza2[i]);
- bukvi2[niza2[i] - 'a'] = 1;
- }
- }
- for(int i = 0; i < 26; i++) {
- if(bukvi1[i] == 1 && bukvi2[i] == 1) {
- fprintf(o, "%c,", (char)(i + 'a'));
- }
- }
- fprintf(o, "\n");
- }
- fclose(o);
- FILE *i3 = fopen(argv[3], "r");
- while(fgets(niza1, 500, i3)) {
- printf("%s\n", niza1);
- }
- return 0;
- }
- /*
- in contrast
- removed from the definition, a phenomenon known as the AI
- 1 7
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement