That is: red+yellow+yellow+green = 17 or red +2 yellow+green = 17 and red+green =5 (the original title has given the conditions).
Replacement: 2 yellow = 17-5 (red+green) = 12, the yellow ball is 12 divided by 2 equals 6.
Red+yellow = 10 Know that the yellow ball seeks the red ball: 10-6=4.
Green+Red =5 Know the red ball and seek the green ball: 5-4= 1 Answer: 4 red balls, 6 yellow balls, 1 green ball.