#K61132. Files Edited by Multiple Developers
Files Edited by Multiple Developers
Files Edited by Multiple Developers
In this problem, you are given commit logs representing file modifications by developers. Each commit log is in the format id file
, where id
is the developer's identifier and file
is the name of the file edited. Your task is to identify and list the files that have been edited by more than one developer.
A file qualifies if and only if the number of distinct developers who modified it exceeds 1, i.e. $$|\text{editors}(file)| > 1.$$ The output should first display the count of such files, followed by the names of these files in lexicographical order, each on a new line.
Input is provided via standard input (stdin) and output should be written to standard output (stdout).
inputFormat
The first line of input contains two integers n and m, where n is the number of developers and m is the number of commit logs. The following m lines each contain a commit log in the format:
id file
where id
is an integer and file
is a string (without spaces) representing the file name.
outputFormat
Output the number of files edited by more than one developer on the first line. Then, output each such file name in lexicographical order on separate lines.
## sample3 5
1 main.py
2 utils.py
3 main.py
2 main.py
1 models.py
1
main.py
</p>