solution to computer exercise pattern recognition duda