Imagine there are only 4 characters: a, b, c, and d
And we want to know how many strings of length 3 can be made with those 4 characters.
First let's list all of the strings that start with 'a' :
There are 4 groups of 4 which means there are 4 * 4 = 16 strings in the above list.
Now imagine if we kept the pattern going. We could copy and paste the above list and change all of the first characters in each string to "b". Then we could paste it again and change all of the first letters to "c", and again for "d". That would make 4 total groups: the first group all start with "a", second group all start with "b", the third all start with "c" and the fourth all start with "d".
So then there would be a total of 4 * 4 * 4 = 43 = 64 strings in the completed list.
So the total number of strings is 43 , which is the number of different characters raised to the power of the length of the string.
I hope this helps explain a little bit where the 627 comes from!