#include <string>
#include <algorithm>
#include <sstream>
#include <vector>
#include <iterator>
#include <iostream>
using namespace std;
string stringCleaner(const string &str)
{
istringstream tempStr(str);
ostringstream cleanLine;
unique_copy(istream_iterator<string>(tempStr),
istream_iterator<string>(),
ostream_iterator<string>(cleanLine, "\n"));
return cleanLine.str();
}
int main()
{
std::cout << stringCleaner("http://w...content-available-to-author-only...a.com\nhttp://w...content-available-to-author-only...b.com\n"
"http://w...content-available-to-author-only...b.com\nhttp://w...content-available-to-author-only...c.com\n"
"http://w...content-available-to-author-only...d.com\nhttp://w...content-available-to-author-only...d.com\n"
"http://w...content-available-to-author-only...d.com\nhttp://w...content-available-to-author-only...d.com\n"
"http://w...content-available-to-author-only...e.com");
}
I2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPHNzdHJlYW0+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxpdGVyYXRvcj4KI2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwpzdHJpbmcgc3RyaW5nQ2xlYW5lcihjb25zdCBzdHJpbmcgJnN0cikKewogICAgaXN0cmluZ3N0cmVhbSB0ZW1wU3RyKHN0cik7CiAgICBvc3RyaW5nc3RyZWFtIGNsZWFuTGluZTsKICAgIHVuaXF1ZV9jb3B5KGlzdHJlYW1faXRlcmF0b3I8c3RyaW5nPih0ZW1wU3RyKSwKICAgICAgICAgICAgICAgIGlzdHJlYW1faXRlcmF0b3I8c3RyaW5nPigpLAogICAgICAgICAgICAgICAgb3N0cmVhbV9pdGVyYXRvcjxzdHJpbmc+KGNsZWFuTGluZSwgIlxuIikpOwogICAgcmV0dXJuIGNsZWFuTGluZS5zdHIoKTsKfQoKaW50IG1haW4oKQp7CiAgICBzdGQ6OmNvdXQgPDwgc3RyaW5nQ2xlYW5lcigiaHR0cDovL3cuLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLmEuY29tXG5odHRwOi8vdy4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4uYi5jb21cbiIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJodHRwOi8vdy4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4uYi5jb21cbmh0dHA6Ly93Li4uY29udGVudC1hdmFpbGFibGUtdG8tYXV0aG9yLW9ubHkuLi5jLmNvbVxuIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImh0dHA6Ly93Li4uY29udGVudC1hdmFpbGFibGUtdG8tYXV0aG9yLW9ubHkuLi5kLmNvbVxuaHR0cDovL3cuLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLmQuY29tXG4iCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaHR0cDovL3cuLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLmQuY29tXG5odHRwOi8vdy4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4uZC5jb21cbiIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJodHRwOi8vdy4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4uZS5jb20iKTsKfQo=