solve data_structure 2 second problem