public long SyntaxScore(string line)
        {
            long score = 0;
            char chpopped;

            ChunkStack.Clear();

            foreach (var ch in line.ToCharArray())
            {
                switch (ch)
                {
                case '(':
                    ChunkStack.Push(ch);
                    break;

                case ')':
                    chpopped = ChunkStack.Pop();
                    if (chpopped != '(')
                    {
                        // bad chunk
                        score += 3;
                    }
                    break;

                case '[':
                    ChunkStack.Push(ch);
                    break;

                case ']':
                    chpopped = ChunkStack.Pop();
                    if (chpopped != '[')
                    {
                        // bad chunk
                        score += 57;
                    }
                    break;

                case '{':
                    ChunkStack.Push(ch);
                    break;

                case '}':
                    chpopped = ChunkStack.Pop();
                    if (chpopped != '{')
                    {
                        // bad chunk
                        score += 1197;
                    }
                    break;

                case '<':
                    ChunkStack.Push(ch);
                    break;

                case '>':
                    chpopped = ChunkStack.Pop();
                    if (chpopped != '<')
                    {
                        // bad chunk
                        score += 25137;
                    }
                    break;

                default:
                    break;
                }
                if (score > 0)
                {
                    break;
                }
            }
            if (score == 0)
            {
                // an incomplete row
                long compScore = 0;
                while (ChunkStack.Count > 0)
                {
                    char ch = ChunkStack.Pop();
                    switch (ch)
                    {
                    case '(':
                        compScore = 5 * compScore + 1;
                        break;

                    case '[':
                        compScore = 5 * compScore + 2;
                        break;

                    case '{':
                        compScore = 5 * compScore + 3;
                        break;

                    case '<':
                        compScore = 5 * compScore + 4;
                        break;

                    default:
                        break;
                    }
                }
                CompScores.Add(compScore);
            }
            return(score);
        }