Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

C++ - Longest Suffix

Phenom1111
Phenom1111 


Write and test a function that finds and returns through an output parameter the longest common suffix of two words (e.g., the longest common suffix of "procrastination" and "destination" is "stination," of "globally" and "internally" is "ally", and of "gloves" and "dove" is the empty string). Attachments
Tags Clarifications

Answers

C++ - Longest Suffix - Solution

dickersonka
dickersonka 



Attached is the solution... Attachments
longest.cpp (1 K) Download Preview
main() { string result; longest("procrastination", "destination", result); cout << "(procrastination, destination): " << result << endl; longest("globally", "internally", result); cout << "(globally, internally): " << result << endl; longest("gloves", "dove", result); cout << "(gloves, dove): " << result << endl;

Screenshots
Purchase Answer