Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int strLen(char *str)
- {
- int i = 0;
- while (str[i] != '\0')
- {
- i++;
- }
- return i;
- }
- int main()
- {
- char str1[100];
- char str2[100];
- gets(str1);
- scanf("%s", str2);
- int len1 = strLen(str1);
- int len2 = strLen(str2);
- int count = 0;
- for (int i = 0; i < len1; i++)
- {
- int flag = 1;
- for (int j = 0; j < len2; j++)
- {
- if (str1[i] != str2[j])
- {
- flag = 0;
- break;
- }
- i++;
- }
- if (flag)
- {
- count++;
- }
- }
- printf("%d times", count);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement