Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <locale.h>
- #include <string.h>
- int main(void) {
- setlocale(LC_ALL, "en_US.utf8");
- char strOne[100], strTwo[100];
- char space = ' ';
- char *ach;
- int spaces = 0;
- printf("Введите первую строку: ");
- scanf(" %[^\t\n]s",strOne);
- printf("Введите вторую строку: ");
- scanf(" %[^\t\n]s",strTwo);
- while(NULL != strchr(strOne, space)) {
- ach = strchr(strOne, space);
- spaces++;
- ach = strchr(ach, ach[1]);
- strncpy(strOne, ach, 100);
- }
- while(NULL != strchr(strTwo, space)) {
- ach = strchr(strTwo, space);
- spaces++;
- ach = strchr(ach, ach[1]);
- strncpy(strTwo, ach, 100);
- }
- printf("%d ", spaces + 2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement