Make multiple two lines equal

I have a question about the making two lines equal.
I know I can use the trim curve to solve this question.
Because I need to make two lines the same length at the same time.
Could you help to solve this issue with the Script(.py ) or Grasshopper?
Trim_curve_Script (9.7 KB)

Hi HS_Kim,
Thank you for your help.
This GH can be applied to one group ( Two Curve).
If this GH can be applied to multiple group at same time. This GH will be closer to what I want.

My demo gh is for two straight lines, not for free form curves…

Anyway if you want apply your definition to multiple cases at the same time, “Graft” should work in most of the cases in gh but before you jump right into the graft or flatten things, I strongly recommend you to navigate and learn about the data tree first.
And there’re a ton of tutorials for beginners out there (like this)so check them first.

Thank you so much. I will learn from your link.