public SectMap Map(SectMap map) { SectMap mapped = new SectMap(); foreach (var item in map) { var newSect = Int32.Parse(item.Key); var newPosi = item.Value; mapped.Add(SectorsMap.ContainsKey(newSect) ? SectorsMap[newSect].ToString() : newSect.ToString(), PositionsMap.ContainsKey(newPosi) ? PositionsMap[newPosi] : newPosi); } return(mapped); }
private int SumLetterPositions(string word) { int result = 0; foreach (var item in word.ToCharArray()) { int tmp; if (PositionsMap.TryGetValue(item, out tmp)) { result += tmp; } } return(result); }