fork download
  1. IDENTIFICATION DIVISION.
  2. PROGRAM-ID. IDEONE.
  3.  
  4. ENVIRONMENT DIVISION.
  5.  
  6. DATA DIVISION.
  7. WORKING-STORAGE SECTION.
  8. 01 b PIC X(100) .
  9. 01 i PIC 9(3) .
  10. 01 du PIC 9(16) VALUE 0.
  11. 01 dl PIC 9(16) VALUE 0.
  12. 01 d PIC X(31) .
  13. 01 m PIC 9(16) VALUE 1000000000000000.
  14. 01 c PIC 9 .
  15. 01 q PIC 9 .
  16. 01 r PIC 9(16) .
  17.  
  18. PROCEDURE DIVISION.
  19. ACCEPT b
  20. PERFORM VARYING i FROM 1 BY 1 UNTIL i > 100
  21. COMPUTE du = du * 2
  22. COMPUTE dl = dl * 2
  23. MOVE b(i:1) TO c
  24. COMPUTE dl = dl + c
  25. DIVIDE dl BY m GIVING q REMAINDER r
  26. MOVE r TO dl
  27. COMPUTE du = du + q
  28. END-PERFORM.
  29. STRING
  30. du dl(2:15)
  31. INTO d
  32. END-STRING.
  33. DISPLAY d.
  34. STOP RUN.
  35.  
Success #stdin #stdout 0s 4008KB
stdin
1101101001111100011110010011001011010101000001001010111010010010101111110001100011110011010111111111
stdout
1081891380587466484599908939262