fork download
  1. // test1.c
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6. int c;
  7. int spc, tab, ret;
  8.  
  9. spc = tab = ret = 0;
  10. while ((c = getchar()) != EOF) {
  11. switch (c) {
  12. case ' ': spc++; break;
  13. case '\t': tab++; break;
  14. case '\n': ret++; break;
  15. }
  16. }
  17. printf("spc=%d tab=%d ret=%d\n", spc, tab, ret);
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 1680KB
stdin
// test1.c
#include <stdio.h>

int main()
{
	int c;
	int spc, tab, ret;
	
	spc = tab = ret = 0;
	while ((c = getchar()) != EOF) {
		switch (c) {
		case ' ':  spc++; break;
		case '\t': tab++; break;
		case '\n': ret++; break;
		}
	}
	printf("spc=%d tab=%d ret=%d\n", spc, tab, ret);
	return 0;
}
stdout
spc=38 tab=18 ret=19