Write method/function that takes a string and counts how many colors are used in that string. For the purposes of our challenge, let’s say that the…