Advertisement
Josif_tepe

Untitled

Jun 12th, 2021
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.01 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4. #include <math.h>
  5.  
  6.  
  7. int main() {
  8.     char z[20];
  9.     char niza[100][100];
  10.     int x = 0;
  11.     while(fgets(niza[x], 90, stdin)) {
  12.         if(niza[x][0] == '#') {
  13.             break;
  14.         }
  15.         x++;
  16.     }
  17.     fgets(z, 10, stdin);
  18.     char z1 = z[0];
  19.     char z2 = z[1];
  20.     for(int i = 0; i < x; i++) {
  21.         int S = -1, E = -1;
  22.         for(int j = 0; j < strlen(niza[i]); j++) {
  23.             if(isspace(z1)) {
  24.                 if(isspace(niza[i][j]) && S == -1) {
  25.                     S = j;
  26.                 }
  27.             }
  28.             if(niza[i][j] == z1 && S == -1) {
  29.                 S = j;
  30.             }
  31.             if(niza[i][j] == z2 && E == -1) {
  32.                 E = j;
  33.             }
  34.         }
  35.         for(int j = S + 1; j < E; j++) {
  36.             printf("%c", niza[i][j]);
  37.         }
  38.         printf("\n");
  39.     }
  40.  
  41.     return 0;
  42. }
  43. /*
  44.  
  45. 12345 Maja Majovska: 54
  46. 15145 Aco Acoski: 95
  47. 14785 Martin Martinoski: 87
  48. #
  49.   :
  50.  
  51.  **/
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement