Under construction

Still being built. Things may change

Equal Schedules

Time limit1sMemory limit1024 MB

Summary
Given two on-call schedules, print how much each teammate's on-call time changed from the first schedule to the second, sorted by name.
Level

Easy2 of 10

Topics
Hash map, Implementation, String, Sorting
Solved
No attempts yet

Problem

You are one of the people on-call for a high-availability service that lets users solve programming tasks. Your team has an on-call schedule that says who is responsible for the service at each time.

A colleague sent you a new schedule. You want to check that everyone has the same on-call time as before, and print any differences.

The on-call schedule is written as lines of the form sis_i eie_i tit_i. Here sis_i and eie_i are the start and end offsets of a shift, counted from some start hour, and tit_i is the teammate on call for that shift.

For example, take this schedule.

0 7 jan
7 14 tomaz
14 20 jure
20 24 jan
24 25 tomaz
25 26 jure

jan is on call for the first 7 hours (hours 0 through 6), and tomaz is on call for the next 7. In total, jan is on call for 11 hours, tomaz for 8, and jure for 7.

Input

The input contains two schedules separated by a line ------. Each schedule has one or more lines of the form sis_i eie_i tit_i, where the integers sis_i and eie_i mean that teammate tit_i is on call for hours from sis_i up to but not including eie_i. A final line ====== comes after the second schedule.

Output

Print the differences between the two schedules as ti±dit_i \pm d_i, where did_i is the second schedule's on-call time minus the first schedule's on-call time for teammate tit_i. Sort the output by teammate name in alphabetical order. Omit teammates with no difference. Every printed difference has a + or - sign. If no differences exist, print No differences found.

Constraints

For each schedule, the following holds:

  • s1=0s_1 = 0
  • si<eis_i < e_i
  • si+1=eis_{i+1} = e_i
  • ei≤1000e_i \leq 1000
  • The name tit_i consists of lowercase English letters.
  • 3≤∣ti∣≤203 \leq |t_i| \leq 20

Examples3

  1. Example 1

    Input
    0 7 jan
    7 14 tomaz
    14 20 jure
    20 24 jan
    24 25 tomaz
    25 26 jure
    ------
    0 9 tomaz
    9 20 jan
    20 26 jure
    ======
    
    Expected output
    jure -1
    tomaz +1
    
  2. Example 2

    Input
    0 7 nino
    7 14 bgs
    14 21 ines
    ------
    0 7 ines
    7 14 nino
    14 21 bgs
    ======
    
    Expected output
    No differences found.
    
  3. Example 3

    Input
    0 3 vid
    3 6 maks
    6 9 janez
    ------
    0 1 vid
    1 2 vid
    2 3 vid
    3 4 maks
    4 5 maks
    5 6 maks
    6 7 janez
    7 8 janez
    ======
    
    Expected output
    janez -1