コード例 #1
0
        private static VariableLetterGroup RankLetters(VariableLetterGroup letters)
        {
            VariableLetterGroup copy = new VariableLetterGroup(letters);
            VariableLetterGroup res  = new VariableLetterGroup();

            while (copy.Length() > 0)
            {
                res.Add(new Letter(copy[0].GetLetter()));

                int i    = 1;
                int rank = 1;

                while (i < copy.Length())
                {
                    if (copy[i] == copy[0])
                    {
                        res.Add(new Letter(copy[i].GetLetter(), rank));
                        copy.RemoveAt(i);
                        rank++;
                    }
                    else
                    {
                        i++;
                    }
                }

                copy.RemoveAt(0);
            }

            return(res);
        }
コード例 #2
0
        public static VariableLetterGroup operator +(VariableLetterGroup a, VariableLetterGroup b)
        {
            VariableLetterGroup c = new VariableLetterGroup(a);

            c.Add(b);
            return(c);
        }