I am currently doing an algorithms project where we have to use two text files to fill in the blanks with the missing words. One of the txt files contains a whole script of a movie called "The Truman Show" while the other txt file contains sentences (statements) with missing words which are indicated by ''.I have found the missing word from the Script.txt and I know how to that I am supposed to use replaceAll to replace '' with the specific word.
I am using BufferedReader to scan both txt files and both one buffered reader has a pointer i and the other buffered reader has a pointed j. i stops at the beginning of the missing word, how am I supposed to use the pointer j to obtain the missing word.
while(i < Movie_Script_Length)
{
if(Current_Statement.charAt(j) == Movie_Script.charAt(i))
{
i++;
j++;
}
else if(Current_Statement.charAt(j) != Movie_Script.charAt(i) && Current_Statement.charAt(j) == Underscore)
{
//Replace the underscores with the word
Current_Statement.replaceAll(regex, replacement);
//System.out.println("Missing word found for Statement " + Statement_Number);
}