Trong lúc rảnh, Dũng đã quyết định sáng tác một số bài hát bằng tiếng Anh có độ phức tạp về các con vật được nuôi ở Viện Công nghệ Thực phẩm gần nhà. Đầu tiên, anh liệt kê một dãy gồm cụm từ, mỗi cụm từ mô tả một con vật. Sau đó, anh sử dụng thuật toán sau để sáng tác bài hát.
Hát Look at the animals, dancing, dancing,
Hát Look at the animals, dancing to the music.
for i từ 1 đến n do
    for j từ i đến 2 do
        Hát xâu A[j]
    end for
    if i > 1 then
        Hát and
    end if
    Hát A[1]
    Hát dancing, dancing,
    Hát Look at the animals, dancing to the music.
end for
Để tính xem mình tốn bao nhiêu sức để hát bài hát do mình sáng tác ra, Dũng quyết định đếm số chữ cái tiếng Anh (cả in hoa lẫn in thường) xuất hiện trong bài hát. Hãy viết chương trình giúp Dũng làm điều đó.
5
one fat cat
two big elephants
three small bats
four long snakes
five thin bears
498
Look at the animals, dancing, dancing,
Look at the animals, dancing to the music
One fat cat, dancing, dancing,
Look at the animals, dancing to the music
Two big elephants and one fat cat, dancing, dancing,
Look at the animals, dancing to the music
Three small bats, two big elephants, and one fat cat, dancing, dancing,
Look at the animals, dancing to the music
Four long snakes, three small bats,
Two big elephants, and one fat cat, dancing, dancing,
Look at the animals, dancing to the music
Five thin bears, four long snakes, three small bats
Two big elephants, and one fat cat, dancing, dancing,
Look at the animals, dancing to the music