27 lines
870 B
C++
27 lines
870 B
C++
#include <vector>
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <numeric>
|
|
#include <iterator>
|
|
#include <chrono>
|
|
#include "iosifovitch.h"
|
|
|
|
int main() {
|
|
std::ios::sync_with_stdio(false);
|
|
std::vector<std::string> words;
|
|
words.reserve(1000);
|
|
std::copy(std::istream_iterator<std::string>(std::cin), {}, std::back_inserter(words));
|
|
std::cout << "words read: " << words.size() << '\n';
|
|
auto begin = std::chrono::steady_clock::now();
|
|
for (auto const& w : words)
|
|
for (auto const& y : words)
|
|
{
|
|
auto distance = levenshtein_distance(w, y);
|
|
if (distance > (std::numeric_limits<unsigned int>::max() - 2))
|
|
{
|
|
std::cerr << "failure : " << w << ", " << y << "/" << distance << '\n';
|
|
}
|
|
}
|
|
std::cout << "total time taken: " << std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count() << std::endl;
|
|
return EXIT_SUCCESS;
|
|
} |