How to get a new array with new data structure on conditions from the origin array

welcome to shbcf.ru