Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdbool.h>
  4. int main(void) {
  5. int sym = 0, count = 0, counter = 0;
  6. char str1[1024] = "12345";
  7. char str2[1024] = "12375";
  8. if (strcmp(str1, str2) == 0)
  9. puts("Строки идентичны");
  10. else
  11. puts("Строки отличаются");
  12.  
  13. printf("%d", strlen(str1));
  14. for (int i = 0; i < strlen(str1); i++) {
  15. if (str1[i] == '3')
  16. count++;
  17. }
  18. printf("%d", count);
  19. int maxlen = 0;
  20. for (int i = 0; i < strlen(str1); i++) {
  21. bool otrezok = false;
  22. for (int j = 0; j < strlen(str2); j++) {
  23. if (str1[i] == str2[j])
  24. otrezok = true;
  25. }
  26. if (!otrezok)
  27. ++counter;
  28. if (otrezok && counter > 0) {
  29. if (maxlen < counter) {
  30. maxlen = counter;
  31. }
  32. counter = 0;
  33. }
  34.  
  35.  
  36. }
  37. printf("%d", maxlen);
  38.  
  39. const char *first = "first";
  40. const char *second = "second";
  41. char third[512];
  42. snprintf(third, sizeof third, "%s%s", first, second);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement