3 balls into 3 cells problem What is the proper way of doing the following?
Given three balls and three cells that can contain up to three balls, how many ways are there of arranging the balls in three cells?
By doing the following I get an answer of 27, but I would like to know of a better way of doing this:
abc-0-0 (3 ways of doing this in total, by moving abc into different cells)
ab-c-0
ab-0-c (2*3 ways of doing these two by shifting ab to the right and varying c in the remaining positions)
ac-b-0
ac-0-b (2*3)
cb-a-0 
cb-0-a (2*3)
a-b-c
a-c-b (3*2 ways in total of varying the positions; again by shifting a to the right)
Thus we get: 3+6+6+6+6=27
I believe this post is linked: Partition 3 elements into 3 ordered cells
but the answer is from the OP, and it is not very elaborate.
 A: There are 3 places to put the first ball, 3 for the second, and 3 again for the third. 3x3x3=27
In general, if you want to put n balls in m cells with no further restrictions, there are n cells to place the first, n for the second, etc. giving $m^n$ possibilities.
A: The answer of $3^3 = 27$ possibilities is correct if you assume the three balls are distinguishable (i.e. different). I don't see this being specified in your question, so even though you already accepted that as the correct answer, I would like to point out the difference if we have three identical balls instead of three different balls.
If you had 3 identical balls, you can solve it this way: label a ball as O and use the symbol | to represent a separation between cells, a few arrangements examples would be:


*

*O|O|O (one ball in each cell)

*|OOO| (all balls on the middle cell)

*O||OO (one ball in the leftmost cell, no balls in the middle cell and two balls in the rightmost cell)


And so on. Now, you just have to realize that all permutations of O|O|O represent a different arrangement (and covers all arrangements). Now your problem is to calculate how many permutations there exists for O|O|O. And those are
$$\dfrac{(3+2)!}{3! \times 2!} = 10$$
possibilites.
EDIT (to reflect comment): in fact, this approach considers the balls to be indistinguishable but the cells still distinguishable, since for example OOO|| and ||OOO are different permutations (the former represents three balls in the leftmost cell, the latter represents three balls in the rightmost cell). See how we are distinguishing the cells here ("leftmost" and "rightmost"). What is "indistinguishable" about the cells here is only the "cell divisory" (the symbol |), which is just a trick to allow the representation of the problem using those symbols.
If you wish to consider the problem in which both the balls and cells are indistinguishable, there are only three possibilities, namely:


*

*All balls in a single cell

*Two balls in one cell, the other ball in another cell

*One ball in each cell

