Сколько слов
Всего вариантов.
Ответ: 150.
Приведём решение на языке Python.
from itertools import product
s='метро'
s0='мтр'
s3='ео'
words=[]
for w in product(s,repeat=4):
if (w[0] in s0) and (w[3] in s3):
words.append(w)
print(len(words))
Приведём другое решение на языке Python.
import itertools
alphabet = "МЕТРО"
con = "МТР"
vol = "ЕО"
ar = itertools.product(alphabet, repeat=4) #Размещение с повторением
arl = []
for i in ar:
arl.append(list(i))
count = 0
for e in arl:
if e[0] in con and e[-1] in vol:
count += 1
print(count)
Приведём решение Сергея Донец на языке PascalABC.NET.
begin
'МЕТРО'.Cartesian(4)
.Where(s->s.First in 'МТР')
.Where(s->s.Last in 'ЕО')
.Count.Print;
end.

