728x90
반응형
문제 : https://codeup.kr/problem.php?id=1419
문제 설명
영어 문장이 입력된다.
그 문장에서 love가 몇 번 나오는지 출력하시오.
# include <stdio.h>
# include <string.h>
# include <limits.h>
int main()
{
char arr[101];
int i,count=0;
gets(arr);
for(i = 0; i<strlen(arr); i++)
{
if(arr[i] == 'l' && arr[i+1] == 'o' && arr[i+2] == 'v' && arr[i+3] == 'e')
count++;
}
printf("%d",count);
return 0;
}
728x90
반응형
최근댓글