The question is all in the title. Here's an example:
Elements: A, B; Length: 4:
AABB
ABAB
ABBA
BABA
BBAA
BAAB
There are 6 such unique strings for 2 elements and length 4.
(I discovered this question when working out the performance of some graph theory algorithms. Please let me know if it's a duplicate! The specific problem I'm working on only has two elements in the strings, but I thought the general case would make a more interesting question.)