Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In the previous version, when you successively input same strings, then end the loop by ctrl+z(windows), the result is no duplicated words, which is not accord with our input.(eg. input three "123" and then ended with ctrl+z). The reason is that if the inputs are same from start, we will never enter the else branch where assign value to variable 'max_duplicated'. So the operation on 'max_duplicated' should be done only when the 'count > max_duplicated.second + 1', which shows that continously duplicated inputs are tested. And when the input is not same with the previous, we should set the count for the new string to 1.
- Loading branch information