codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#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; }
Private
[
?
]
Run code
Submit