-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib-encoding.h
67 lines (61 loc) · 3.07 KB
/
lib-encoding.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef ENCODING_H
#define ENCODING_H
#include <string>
#include <map>
#include <algorithm>
// Encoding map
const std::map<char, std::string> encoding_map = {
{'a', ";EDDAI"}, {'b', ";FROCIO"}, {'c', ";skks"}, {'d', ";stocazzum"},
{'e', ";miau"}, {'f', ";gatto"}, {'g', ";shell"}, {'h', ";cazzarola"},
{'i', ";azzo"}, {'j', ";bau"}, {'k', ";MaNonLoSoHoFinitoLeParoleRandomicheDaMettere"},
{'l', ";gronc"}, {'m', ";releone"}, {'n', ";fuckmepls"}, {'o', ";milliseconds"},
{'p', ";mare"}, {'q', ";lago"}, {'r', ";straykids"}, {'s', ";alfabeto"},
{'t', ";droga"}, {'u', ";eldenring"}, {'v', ";hollowknight"}, {'w', ";hollow"},
{'x', ";yz"}, {'y', ";gattinibellissimi"}, {'z', ";sigmeyer"},
{'A', ";elikoper"}, {'B', ";JELIKOPETER"}, {'C', ";wlattrocca"}, {'D', ";wigattini"},
{'E', ";hex"}, {'F', ";GGH"}, {'G', ";Lll"}, {'H', ";miuwww"},
{'I', ";motard"}, {'J', ";patate"}, {'K', ";figosaLaCappa"}, {'L', ";nonsoaltreparolepercodificare"},
{'M', ";pippo"}, {'N', ";PippoBaudo"}, {'O', ";letteraStramba"}, {'P', ";pIsForPoppe"},
{'Q', ";quaderno"}, {'R', ";baubaubaumiao"}, {'S', ";StandsForStrunz"},
{'T', ";voglioungatto"}, {'U', ";wleCANNE"}, {'V', ";FR"}, {'W', ";ProtocolloTCP"},
{'X', ";mutande"}, {'Y', ";hofinitoleparole"}, {'Z', ";eStatoUnPartoTirareCosiTanteParoleRandomiche"},
{' ', "_"}, {'=', ";FUNZIONA"}, {'.', ";DAJECAZZOVAI"}, {'[', ";LeonardoEGAY"},
{']', ";TantoGay"}, {':', ";Gayone"}, {';', ";<>"}, {'!', ";HoFinitoLeIdeeLOL"},
{'|', ";QuantiCaratteriMancano?"}, {'$', ";NonStoDelirandoGiuro"}, {'#', ";OkayForse"},
{'\'', ";CreareStaCodifica_èStataUnaSfida"}, {'"', ";UnaSfidaControLaMiaSaluteMentaleLOL"},
{'/', ";SoRetardato"}, {'\\', ";WlaFiga"}, {'<', ";boh_nonSoCheScrivere"},
{'>', ";meowMEOW_BITCH"}, {')', ";miuw"}, {'(', ";alfa"}, {'&', ";SIUMTATTICOSO"},
{'%', ";NoAllAlcolismo"}, {'1', ";KkA"}, {'2', ";aAa"}, {'3', ";hhH"},
{'4', ";meOWWWWWW"}, {'5', ";AAAAAAAA"}, {'6', ";SEX"}, {'7', ";SIVENSTEVEN"},
{'8', ";NumberOfStrayKids"}, {'9', ";CazzumNine"}, {'0', ";PaliNonPresiDaLeonardo"}
};
// Decoding map
const std::map<std::string, char> decoding_map = [] {
std::map<std::string, char> temp;
for (const auto& pair : encoding_map) {
temp[pair.second] = pair.first;
}
return temp;
}();
// Function to encode a string
std::string encode(const std::string& text) {
std::string encoded_text;
for (const char& c : text) {
auto it = encoding_map.find(c);
encoded_text += (it != encoding_map.end()) ? it->second : std::string(1, c);
}
return encoded_text;
}
// Function to decode a string
std::string decode(const std::string& encoded_text) {
std::string decoded_text = encoded_text;
for (const auto& pair : decoding_map) {
size_t pos = 0;
while ((pos = decoded_text.find(pair.first, pos)) != std::string::npos) {
decoded_text.replace(pos, pair.first.length(), 1, pair.second);
pos += 1;
}
}
return decoded_text;
}
#endif // ENCODING_H