fork download
  1. #include<stdio.h>
  2. main(){
  3. int c,p=0,r=0,n=0,rn=0;
  4. while(EOF!=(c=getchar()))switch(c){
  5. case 13:++p,++r;break;
  6. case 10:1==p?(--r,++rn):++n;
  7. default:p=0;
  8. }
  9. return printf("cr=%d\nlf=%d\ncr+lf=%d\n",r,n,rn),0;
  10. }
Success #stdin #stdout 0s 2296KB
stdin
aaaa
bbbb
cccc
stdout
cr=0
lf=2
cr+lf=0