1#include <bits/stdc++.h>
12 if(c <= 20 || c ==
' '){
27 return !s.empty() && s[0] ==
'/';
31 for(
int i = 0; i < 4; i++){
34 reverse(s.begin(),s.end());
35 while(s.back() !=
'm'){
39 reverse(s.begin(),s.end());
46 float similarity = stod(s);
60 if(_path1 > _path2) swap(_path1,_path2);
84 while(getline(cin,line)){
89 if( int32_t(tokens.size()) != 2 || !
is_an_file(tokens[0])){
92 string path_compared = tokens[0];
97 comparations.insert(com);
104 set<Comparation> comparations;
106 while(getline(cin,line)){
108 if(tokens.empty())
continue;
111 for(
auto token : tokens){
118 for(
int i = 0; i < 4; i++) path.pop_back();
121 cout << comparations.size() <<
'\n';
122 for(
auto com : comparations){
123 cout << com.path1 <<
' ' << com.path2 <<
' ';
124 cout << fixed << setprecision(2) << com.similarity <<
'\n';
128int main(
int argc,
char *argv[]){
vector< string > parser_line(string line)
void parser_block(string path, set< Comparation > &comparations)
int main(int argc, char *argv[])
string remove_formatation_from_similarity(string s)
bool is_an_file(string s)
double retrive_similarity(string s)
Structure representing a code comparison result.
bool operator<(const Comparation &com) const
double similarity
Similarity score between the files (0-100)
Comparation(string _path1, string _path2, double _sim)
string path1
Path to first code file being compared.
bool operator==(const Comparation &com) const
string path2
Path to second code file being compared.