main open the master file get a file name while success process a file get a file name close the master file. process a file Input: the base file name construct the input and output file names open the input file open the output file if successful process the message else print an error message close the input file close the output file process the message Input: open input file, open output file get a line while successful decode the line write the word to the output file get a line decode a line Input: a line of text Output: a word Get the count and direction If the direction is left reverse the line subtract 1 from the count Get the word at position count from the line return this word. get the word at position count Input: a line of text a count output a word set position to 0 while position is less than count space = find the position of the first space word = everything before the first space line = everything after the first space increase position by 1 return word