import java.util.*;class N{static{Scanner b=new Scanner(System.in).useDelimiter("\\D");for(int c=0,i=-1;i>-3;c+=Long.bitCount(b.nextInt()))if(i++%4>2){System.out.println(c);c=0;}}}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).