fork(3) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.  
  7. char buf[9999];
  8. int input;
  9.  
  10. int distance;
  11.  
  12. char *ptr, *qtr;
  13.  
  14. while ( fgets( buf, sizeof(buf), stdin)!=NULL ) {
  15.  
  16. ptr=buf;
  17. qtr=ptr+1;
  18.  
  19.  
  20. while ( *(qtr)!='\n' ) {
  21.  
  22.  
  23. distance=( *qtr-'a' ) - ( *ptr-'a');
  24.  
  25. if( distance>=0 ) {
  26. printf("%d", distance);
  27. }
  28. else {
  29. printf("%d", -distance);
  30.  
  31. }
  32. qtr++;
  33. ptr++;
  34. }
  35. printf("\n");
  36. }
  37.  
  38. }
  39.  
Success #stdin #stdout 0s 2156KB
stdin
Standard input is empty
stdout
Standard output is empty