[ create a new paste ] login | about

Link: http://codepad.org/Hc0wDjYr    [ raw code | output | fork ]

C, pasted on Jul 10:
#include <stdio.h>
#include <stdlib.h>                                      // malloc을 사용하기 위한 헤더파일
#include <string.h>                                     // strlen과 strcpy을 사용하기 위한 헤더파일
#define MAX 1000000
 
int main()
 
{
 
	char temp[MAX];                                      // 문자열을 입력 받기 위한 충분한 크기의 문자 배열을 선언한다.
	int count=0;
 
		gets(temp);                                             // 문자열을 입력 받는다.
printf("%s\n", temp);
		int i=0;
 
		while (1)
		{
			if (temp[i] == '\0')
				break;
 
			if (temp[i] == 32)
					count++;
 
			i++;
 
		}
printf("%d %d", ++count, i);
return 0;
 
}


Output:
1
2

1 0


Create a new paste based on this one


Comments: