I copied the code exactly, and it always returns 1, even for an input with 500,000 characters. That's because of the broken
==true
test. Once that's fixed, it works fine, even with a million characters input:
yes One | tr -d "\n" | head -c 1000000 | ./67955465
, so the problem is likely with your environment. BTW, once you have it working, there's a lot of problems that a good
Code Review could help you improve. —
Toby Speight 56 secs ago