Advertisement
evage

2)

Dec 6th, 2021
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1. #include <stdio.h>
  2. #define L 26
  3. #define MAXS 1000
  4. int to_lower(int c) {
  5.     if (c >= "A" && c <= "Z")
  6.         return c + 32;
  7.     return c;
  8. }
  9. int main(void) {
  10.     char symbolsS1[L]; for (int i = 0; i < L; ++i) *(symbolsS1 + i) = 0;
  11.     char stringS[MAXS];
  12.     char stringS1[MAXS];
  13.     char ch;
  14.     int i,j;
  15.  
  16.     printf("Enter s\n");
  17.     for (i = 0; (ch = getchar()) != '\n'; ++i)
  18.         *(stringS + i) = ch;
  19.     *(stringS + i) = '\0';
  20.    
  21.     printf("Enter s1\n");
  22.     for (j = 0; (ch = getchar()) != '\n'; ++j)
  23.         *(stringS1 + j) = ch;
  24.     *(stringS1 + j) = '\0';
  25.    
  26.     for (int k = 0; k < j; ++k)
  27.         ++(*(symbolsS1 + to_lower(*(stringS1 + k)) - 'a'));
  28.  
  29.     int len = 0;
  30.     for (int k = 0; k < i; ++k)
  31.         if (!(*(symbolsS1 + *(stringS + k) - 'a'))) ++len;
  32.     printf("len %d", len);
  33. }  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement