A={a,b}^3
you can write as A={a,b} {a,b} {a,b}
A={(a,a)(a,b)(b,a)(b,b)} {a,b}
A= { (a,a,a) (a,a,b) (a,b,a) (a,b,b) (b,a,a) (b,a,b) (b,b,a) (b,b,a) }
So |A|= 8
But you need to understand difference between Set and Multiset.
In Set, repeated value is count only one time Example- A= {a,a,b,b,c} which is equal to {a,b,c} but in this question after calculating {a,b}^3 No set will be repeated so |A| is equal to 8