#include "common.h" #include "huffman.h" #define pb push_back int getweight(string s) { if(s[0]=='$') return 1000; else if(s=="farmer"||s.length()==1||s=="example")return 1; else return 10; } struct clause { vector words; vector weights; string s; int weight; void parse() { string word=""; bool iseq=false; for(int j=0;jweight)weight=w; } }; struct sentence { vector clauses; string s; int weight; void parse() { string cl=""; bool iseq=false; for(int j=0;jweight)weight=c.weight; } } }; vector text; vector value; string line; int b,c; void init() { cin>>c; ifstream stin("soc1.txt"); string sentencefile=""; bool iseq=false; while(getline(stin,line)) { for(int i=0;i test = huffman::encode("asdfjkl;1234"); for (auto b : test) cout << b; cout << '\n'; string s = huffman::decode(test); cout << s << '\n'; }