public void Put(string str, int pos)
{
try
{
if (string.IsNullOrEmpty(str))
{
return;
}
if (!words.ContainsKey(str))
{
var wordPositions = new List<int> { pos };
words.Add(str, wordPositions);
}
else
{
List<int> modified = words[str];
if (!modified.Contains(pos))
{
modified.Add(pos);
}
}
}
catch (Exception)
{
}
}