If all you are doing for now is count adjacent coins then use a for loop and a single if statement.


for each coin (except the last one) {
if current coin equals next coin {
...