We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
It's not a bug per say. It seems like the last line of input doesn't have a newline after it. Instead of doing a while read loop, just do INPUT="$(cat)"and thenfor i in $INPUT; do ... done.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Compute the Average
You are viewing a single comment's thread. Return to all comments →
It's not a bug per say. It seems like the last line of input doesn't have a newline after it. Instead of doing a
while read
loop, just doINPUT="
$(cat)"and then
for i in $INPUT; do ... done
.