printDuplicates
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 I I I 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 I*3 Jack's*2 smirking*5 wow*2 yippee*2 yippee*2 yay*3