Can't seem to redirect input in Terminal
Far less can go wrong if you pipe the input:

cat words.5.txt | /path/to/redirect


In your case, ./program might be needed depending on where you are compiling things or omitting the path entirely. From your edit this should work too:

./redirect &lt; words.5.txt


That bash error is due to the program not existing in $PATH

echo $PATH