Singapore Math Primary 5 Second Math Question

Second challenge question from my kid. Again it took me some time to work out the problem. Singapore math questions are rather more like puzzles than math questions. What practical value do figuring out who has how many pencils serve in real life?

To solve these questions, one needs some basic intelligence and an ample supply of heart- also known as perservence- or grit. Without grit, a weak-minded individual would just give up. And that's exactly what the Singapore government wants. Singapore math serves nothing more than to separate the strong from the weak. It is a simply a basic sorting tool for this meritocractic society.

My kid asked me how can I do my job if I get stomped by a primary school question?
First, the Singapore math question to me is more of a logic puzzle than a math question. And second, no one knows everything. However, the key point is that we do not stay stomped. We use everything in our resources to solve the problem. We attack the problem from different angles. Sooner or later until ceaseless attacks, the solution reveals itself. We are only defeated if we give up.

Kenneth had a total of 576 black and red pens in the ratio 9:7.  After he had given
away an equal number of each type of pens, the number of black and red pens left was
in the ratio 7:4.  How many pens did he give away altogether?
I've generated the solution in this pdf here