Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdbool.h>
- int main(void) {
- int sym = 0, count = 0, counter = 0;
- char str1[1024] = "12345";
- char str2[1024] = "12375";
- if (strcmp(str1, str2) == 0)
- puts("Строки идентичны");
- else
- puts("Строки отличаются");
- printf("%d", strlen(str1));
- for (int i = 0; i < strlen(str1); i++) {
- if (str1[i] == '3')
- count++;
- }
- printf("%d", count);
- int maxlen = 0;
- for (int i = 0; i < strlen(str1); i++) {
- bool otrezok = false;
- for (int j = 0; j < strlen(str2); j++) {
- if (str1[i] == str2[j])
- otrezok = true;
- }
- if (!otrezok)
- ++counter;
- if (otrezok && counter > 0) {
- if (maxlen < counter) {
- maxlen = counter;
- }
- counter = 0;
- }
- }
- printf("%d", maxlen);
- const char *first = "first";
- const char *second = "second";
- char third[512];
- snprintf(third, sizeof third, "%s%s", first, second);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement