# Letters permutations

Source combinatorics before you start:

`source("./includes/letters.R")`

Then try first example:

`stringPermutations("THEORY")`

`stringPermutations`

will return number of unique words
that could be combined from letters of "THEORY".
The actual result will be **720**.
However with the same number of letters result could be different, e.g.:

`stringPermutations("LETTER")`

Result will be **180**, because of `E`

and `T`

letters are duplicated
and thereby should be calculate by formula of Permutation with Repetition:

$\\ P(m) = \frac{m!}{m_{1}!m_{2}!\: \ldots \: m_{k}!}$

Learn more about Permutation with Repetition