open "oddWord.txt" for input as #f ' read input stream while not(eof(#f)) line input #f, a$ oddW$ = "" ' begin the result oddW with blank px = 0 ' begin word search location with 0 count = 0 ' begin the word count to 0 while x < len(a$) ' look at each character x = instr(a$,",",px) ' search for comma (,) if x = 0 then x = len(a$) ' no more commas? x1 = instr(a$,";",px) ' search for (;) x2 = instr(a$,":",px) ' search for (:) if x1 <> 0 then x = min(x,x1) ' what came first the , ; or : if x2 <> 0 then x = min(x,x2) w$ = mid$(a$,px,x - px) ' get the word seperated by , ; or : if count and 1 then ' is it the odd word w1$ = "" for i = len(w$) to 1 step -1 w1$ = w1$ + mid$(w$,i,1) ' reverse odd words next i w$ = w1$ end if oddW$ = oddW$ + w$ + mid$(a$,x,1) ' add the word to the end of oddW$ px = x + 1 ' bump word search location for next while count = count + 1 ' count the words wend print a$;" -> ";oddW$ ' print the original and result next ii wend close #f