Fixed detection of overlong sequences (thanks Tommy!)
No, there's no reason not to use fprintf