// test1.c
#include <stdio.h>
int main()
{
int c;
int spc, tab, ret;
spc = tab = ret = 0;
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;
}
Ly8gdGVzdDEuYwojaW5jbHVkZSA8c3RkaW8uaD4KCmludCBtYWluKCkKewoJaW50IGM7CglpbnQgc3BjLCB0YWIsIHJldDsKCQoJc3BjID0gdGFiID0gcmV0ID0gMDsKCXdoaWxlICgoYyA9IGdldGNoYXIoKSkgIT0gRU9GKSB7CgkJc3dpdGNoIChjKSB7CgkJY2FzZSAnICc6ICBzcGMrKzsgYnJlYWs7CgkJY2FzZSAnXHQnOiB0YWIrKzsgYnJlYWs7CgkJY2FzZSAnXG4nOiByZXQrKzsgYnJlYWs7CgkJfQoJfQoJcHJpbnRmKCJzcGM9JWQgdGFiPSVkIHJldD0lZFxuIiwgc3BjLCB0YWIsIHJldCk7CglyZXR1cm4gMDsKfQo=
Ly8gdGVzdDEuYwojaW5jbHVkZSAmbHQ7c3RkaW8uaCZndDsKCmludCBtYWluKCkKewoJaW50IGM7CglpbnQgc3BjLCB0YWIsIHJldDsKCQoJc3BjID0gdGFiID0gcmV0ID0gMDsKCXdoaWxlICgoYyA9IGdldGNoYXIoKSkgIT0gRU9GKSB7CgkJc3dpdGNoIChjKSB7CgkJY2FzZSAnICc6ICBzcGMrKzsgYnJlYWs7CgkJY2FzZSAnXHQnOiB0YWIrKzsgYnJlYWs7CgkJY2FzZSAnXG4nOiByZXQrKzsgYnJlYWs7CgkJfQoJfQoJcHJpbnRmKCZxdW90O3NwYz0lZCB0YWI9JWQgcmV0PSVkXG4mcXVvdDssIHNwYywgdGFiLCByZXQpOwoJcmV0dXJuIDA7Cn0K
// 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;
}