using System;

using System.Collections.Generic;

using System.Linq;

using System.Data;

using System.Text.RegularExpressions;


class Program

{

    public struct Data

    {

        public double Number;

        public string Unit;

        public double Priority;

    }

    static void Main(string[] args)

    {

        Dictionary<string, double> _priority = new Dictionary<string, double>() { { "원", 0.0001 }, { "만원", 1 } };

        List<string> _list = new List<string>() {

            "홍길동, 제주도, 3만원, 1만원, 2만원",

            "홍길동, 제주도, 5만원, 3만원, 2000원",

            "임꺽정, 울릉도, 1만원, 1만원, 0원",

            "문재인, 서울, 100만원, 100만원, 0원",

            "윾동,강원도, 5만원, 2만원, 3만원"

        };

        var group = _list.Select(r => r.Split(',')).GroupBy(r => r[0] + "," + r[1], r => r.Skip(2).ToList()).ToDictionary(r => r.Key, r => r.ToList());

        Dictionary<string, Dictionary<int, Data>> temp = new Dictionary<string, Dictionary<int, Data>>();

        var number = new Regex(@"[0-9]+");

        var unit = new Regex(@"[^0-9 ]+");

        foreach (var g in group)

        {

            temp.Add(g.Key, new Dictionary<int, Data>() );

            for (int i = 0; i < g.Value.Count; i++)

            {

                var nums = g.Value[i].Select(r => number.Matches(r.Trim())[0]).ToList();

                var units = g.Value[i].Select(r => unit.Matches(r.Trim())[0]).ToList();

                for(int ii=0; ii<nums.Count(); ii++)

                {

                    if(temp[g.Key].ContainsKey(ii))

                    {

                        var it = temp[g.Key][ii];

                        var priority = _priority[units[ii].Value];

                        it.Number += Convert.ToInt32(nums[ii].Value) * priority;

                        if (it.Priority < priority)

                        {

                            it.Unit = units[ii].Value;

                            it.Priority = priority;

                        }

                        temp[g.Key][ii] = it;

                    }

                    else

                        temp[g.Key][ii] = new Data() { Number = Convert.ToDouble(nums[ii].Value), Unit = units[ii].Value, Priority = _priority[units[ii].Value] };

                }

            }

        }

        var output = temp.ToList().Select(r => r.Key.ToString() + ", " + new string(r.Value.SelectMany(rr => string.Format("{0}{1}, ", rr.Value.Number, rr.Value.Unit)).ToArray())).ToList();

        for(int i=0; i< output.Count; i++)

        {

            output[i].Remove(output[i].Length - 1);

            Console.WriteLine(output[i]);

        }

        Console.ReadKey();

    }

}


머리가 안 도는구나..