fork download
  1. /* write your code below */
  2. ,[ Read A (10 chars) into memory
  3. >++++++++[-<+++++++++>] Store the first binary number (for example 49 or 48 for '1' or '0')
  4. , Read next A's digit
  5. >++++++++[-<+++++++++>] Store the binary number
  6. , Read next A's digit (do this 10 times for A)
  7. , Repeat for B (5 chars)
  8. >++++++++[-<+++++++++>] Store binary digits for B
  9.  
  10. # Start comparing A with B, starting at index 0 of A
  11. # Compare character by character for 5 consecutive characters
  12. # If all match, output 1, else move to the next starting index in A
  13.  
  14. # Pseudocode logic in Brainf**k:
  15. # for i in range(len(A) - len(B) + 1):
  16. # if A[i:i+len(B)] == B:
  17. # print 1
  18. # exit
  19. # print 0
  20. ]
  21.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty