Class Schedule: Overriding equals and hashCode

Kotlin Medium data classes

Task «Class Schedule: Overriding equals and hashCode»

Create a data class `Lesson` with fields: name (String), teacher (String), classroom (String), day of week (Int, 1-7), lesson number (Int, 1-8). Implement a function that takes a list of lessons and returns a new list where duplicates are removed (lessons are considered identical if all their fields match). The order of the remaining elements must be preserved as in the original list. It is guaranteed that names and teachers do not contain spaces.

Input Format

In the first line, an integer N (1 ≤ N ≤ 1000) — the number of classes. Then N lines, each in the format: "Name Teacher Classroom DayOfWeek PairNumber" (separated by spaces).

Output Format

Output K — the number of unique lessons, then K lines in the same format as in the input data.

main.kt