For example a string contains the following (the string is variable):
http://www.google.comhttp://www.google.com
What would be the most efficient way of removing the duplicate url here – e.g. output would be:
http://www.google.com
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Efficiency has various definitions: code size, total execution time, CPU usage, space usage, time to write the code, etc. If you want to be “efficient”, you should know which one of these you’re trying for.
I’d do something like this:
Depending on the kinds of duplicates you need to remove, this may or may not work for you.