The problem is from Kiselev's Geometry Exercise 587:
Prove that in a scalene triangle, the sum of the diameters of the inscribed and circumscribed circle is congruent to the sum of the segments of the altitudes from the orthocenter to the vertices.
Here is what I have tried: let $a, b, c$ be its sides, $r$ be the radius of the incircle, $R$ be that of the excircle, $h_a$ be the altitude perpendicular to $a$, $h_a'$ be the segment of $h_a$ from the orthocenter to $A$, the vertex on the other side of $a$. Let $S$ be the area of the triangle. Then
$\displaystyle\frac{a+b+c}{2}r = \frac{abc}{4R} = \frac{a}{2}h_a = \frac{b}{2}h_b = \frac{c}{2}h_c$
From the previous exercise 585, we also have $\frac{1}{h_a} + \frac{1}{h_b} + \frac{1}{h_c} = \frac{1}{r}$, although I am not sure whether it will be useful.
Then I tried to prove it algebraically by using the formulas above, but it became very complex and I could not reduce the sum on the right side into the sum of the diameters of the incircle and the excircle.
Any help would be greatly appreciated.