Your buffer is one byte too short - a string of 1000 characters requires 1001 char
s, the last one taken by the nul
terminator.
"lowercase English alphabet" sounds a bit ambiguous - I'd say that by some interpretation, it could contain spaces. If so, the input will be read incorrectly.
I can't see other problems right now, but I'd strongly suspect the first one.