Extract info from text (IBS)

/* Example Input String

Laptop, 1200;Mouse, 25;Keyboard, 75;Monitor, 300 

Expected Console Output

Total cost: 1600

Average price: 400

Most expensive product: Laptop (1200)*/



        static void Main(string[] args)


        {

            string input = "Laptop, 1200; Mouse, 25; Keyboard, 75; Monitor, 300";

            string[] itemsnprice  = input.Split(';');


            Dictionary<string, int> dictItems = new Dictionary<string, int>();

            foreach (string str in itemsnprice)

            {

                string[] strArray = str.Split(',');


                dictItems.Add(strArray[0], int.Parse(strArray[1]));


            }


            int totalCost = 0;

            string key = string.Empty;

            int highvalue = 0;

            foreach (var items in dictItems)

            {

                totalCost += items.Value;

                if(items.Value>highvalue)

                {

                    highvalue = items.Value;

                    key = items.Key;

                }


            }


            int avg = totalCost / dictItems.Count;


            Console.WriteLine($"Total cost: {totalCost}");

            Console.WriteLine($"Average: {avg}");

            Console.WriteLine("Expensive product is: " + key + " "+ dictItems[key]);


            Console.ReadLine();



        }