Sum = 0, Count = 0
while (Pile 1 has more cards)
{
Read the top card X in Pile 1
Sum, Count = addIfNoun(X, Sum, Count)
Move card X to Pile 2
}
AvgT = Sum / Count
CountB = 0
while (Pile 2 has more card)
{
Read the top card X in Pile 2
if (X.LetterCount > AvgT and X.PartOfSpeed == "Noun")
{
CountB = CountB+1
}

Procedure addIf Noun (Y, SumT, CountT)
if(Y.PartOf Speech == "Noun")
{
SumT = SumT + Y.LetterCount
CountT = CountT +1
}
return ([SumT, CountT])
End addIfNoun