The roadplanner fills out the road profile with strips and functions. For the 'mixed' strip, he fills out the following information (example):- parking, 50 meter, 4 intervals- vegetation, 20 meter, 6 intervals- exit, 30 meter, 3 intervals
The length of each function is the total length of all intervals of that function.

The visualisation only shows the 3 functions and not the number of intervals. The planner can not draw/enter each individual interval (as this could take too much time)QUESTION: IS THERE AN 'ALGORITHM' WHICH CALCULTES THE NUMBER OF TRANSITIONS BETWEEN (each possible combination of) 2 FUNCTIONS?
- there is no difference between a transition from functionA-to-functionB and functionB-to-functionA- it can be assumed that the maximum number of functions is 5- it doesn't realy matter with which function the section starts and with which one it ends
- the calculation of the number of transitions does not have to be exact (a deviation of 2 per tranistion between 2 function can be accepted, but the more accurate the better...).
- Please specify assumptions you make to get a working algorithm

I am looking for an algorithm that generates the desired output (as specified) from the given inpu (as specified). Changed some text in problem description and elaborated the pictures to clarify the problem better.