using System;
using System.Collections.Generic;
using System.IO;
public class Test
{
public static void Main()
{
// your code goes here
try
{
String line;
var inputLines = new List<String>();
while((line = Console.ReadLine()) != null) {
line = line.Trim();
if (line != "")
inputLines.Add(line);
}
var retVal = processData(inputLines);
foreach(var res in retVal)
Console.WriteLine(res);
}
catch (IOException ex)
{
Console.WriteLine(ex.Message);
}
}
public static List<String> processData(
IEnumerable<string> lines)
{
/*
* Do not make any changes outside this method.
*
* Modify this method to process `array` as indicated
* in the question. At the end, return a List containing
* the appropriate values
*
* Do not print anything in this method
*
* Submit this entire program (not just this function)
* as your answer
*/
List<String> retVal = new List<String>();
Dictionary<string, string> productDict = new Dictionary<string, string>();
foreach(var line in lines)
{
string[] saleArray = line.Split(", ");
if(productDict.ContainsKey(saleArray[3]))
{
int productPrice = int. Parse(productDict[saleArray[3]]);
int price = int.Parse(saleArray[4]);
if(price < productPrice)
productDict[saleArray[3]] = productPrice.ToString();
}
else
{
productDict[saleArray[3]] = saleArray[4];
}
}
List<string> discountedCustomer = new List<string>();
foreach(var discountedProd in productDict.Keys)
{
foreach(var line in lines)
{
string[] saleArray = line.Split(", ");
if(discountedProd == saleArray[3] && productDict[discountedProd] == saleArray[4])
{
discountedCustomer.Add(saleArray[0]);
}
}
}
return retVal;
}
}