123456789101112131415161718192021222324252627
#include <iostream> #include <string> using namespace std; int main() { string simonPattern; string userPattern; int userScore = 0; int i = 0; userScore = 0; simonPattern = "RRGBRYYBGY"; userPattern = "RRGBBRYBGY"; /* Your solution goes here */ while (userPattern[i] == simonPattern[i]) { userScore = userScore + 1; ++i; if (userPattern != simonPattern) { break; } } cout << "userScore: " << userScore << endl; return 0; }