tzijie:
while( s0 != '|' || s1 != '|' ){//terminates if '|' is receiveddoesnt this mean the loop will run when s0 or s1 are not equal to '|'.
meaning, if either s0 or s1 is equals to '|' , it will stop?
No - if either s1 or s1 is not equal to '|' the loop runs, it will only stop when both s0 and s1 equal '|'.
If you want it to stop when either equals '|' you have to use the logical and operator - then the loop runs if both are not equal to '|':
while( s0 != '|' && s1 != '|' ){ // terminates when a '|' is received in either s0 or s1
Be aware that now you will lose the information in s0 when s1 equals '|'.