fork(2) download
  1. #include <stdio.h>
  2.  
  3. v(char*s){int v=0,c;while(c=*s++)v+=v+c-48;return v;}
  4.  
  5. int main(void) {
  6. // your code goes here
  7. char s[100];
  8. scanf("%s", s);
  9. printf("%s %d",s,v(s));
  10. return 0;
  11. }
  12.  
Success #stdin #stdout 0s 2172KB
stdin
111011
stdout
111011 59