Solution is working as expected but compiler says output is different

programming
Tags: #<Tag:0x00007f18226cc0c8>

#1
cat input|while IFS= read -r -n 1 A;do
if [ "${A}" == "/" ];then 
    echo -n "\\"
elif [ "${A}" == "\\" ];then
    echo -n "/"
fi
done

#2

I think the last thing left is to print a new-line character.
Maybe try an echo in the end.


#3

cat input | tr \\ n | tr \/ v | tr n \/ | tr v \\