QUOTE(lordms12 @ 6 Jul, 2008 - 11:39 AM)

This is a famous problem and can be solved using dynamic programming algorithm, just Google and you will find a lot of good materials.
Hi.
I've Googled it. The search comes with a lot of "longest common
subsequence" results. I'm not sure what a subsequence but I think I've read somewhere that it isn't the same thing as a substring? And the other results used some stuff like Python (?) and C# (?), etc

So far we've only covered iostream, string, int, for loops, while loops, if-else statements, and do-while loops. We're only supposed to use those.
QUOTE(NickDMax @ 6 Jul, 2008 - 11:53 AM)

a "for loop" is a rather simple construct that is most often used to execute loops with a known number of iterations -- i.e. a loop that counts its way though a series of numbers (though this is by no means the only use if the for loop).
CODE
int x; // a counter variable
std::cout << "I can count to ten." << std::endl;
for (x=0; x <10; x++) {
std::cout << x << ", ";
}
std::cout << "\nDone!\nNow Gimme Some CANDY!" << std::endl;
The loop has four parts:
for(
initialization;
condition needed to continue;
increment) {
..inside of loop...}
in the 'initialization' part you set things up, like set your loop variable to 0.
in the 'condition needed to continue' you set the condition needed for the inner portion of the loop to execute -- x < 10
in the increment step you modify the control variable. x++
Thank you

So its just a counting thing? So can it be used to compare strings-- letter by letter?
This post has been edited by chghrtfzzy: 6 Jul, 2008 - 01:36 PM