logo CodeStepByStep logo

dracula

Language/Type: C++ string

What is the value of s after the following code is finished running?

string s = "dracula";
for (int i = 0; i < s.length(); i++) {
    char a = s[0];
    string b = s.substr(1);
    s = b + a;
}
value of s
(order shuffled)

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.