Question: Write a method printDuplicates that accepts a Scanner for an input file. Examine each line for consecutive occurrences of the same token on the same

 Write a method printDuplicates that accepts a Scanner for an input

Write a method printDuplicates that accepts a Scanner for an input file. Examine each line for consecutive occurrences of the same token on the same line and print each duplicated token along how many times it appears consecutively. For example the file: hello how how are you you you you III am Jack's Jack's smirking smirking smirking smirking smirking revenge one fish two fish red fish blue fish bow wow wow yippee yippee yo yippee yippee yay yay yay leads to the following console output: how*2 you*4 1*3 Jack's*2 smirking*5 wow*2 yippee*2 yippee*2 yay*3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!