#include <string>
#include <set>
#include <iostream>
#include <memory.h>
Go to the source code of this file.
|
typedef unsigned char | uint8 |
|
◆ uint8
typedef unsigned char uint8 |
◆ main()
Definition at line 38 of file normalize_prefix.cpp.
39{
40 std::string line;
41 while (std::getline(std::cin, line)) {
42 std::string normalizedLine =
normalize(line);
43 std::cout << normalizedLine << '\n';
44 }
45}
std::string normalize(const std::string &line)
◆ normalize()
std::string normalize |
( |
const std::string & | line | ) |
|
Definition at line 11 of file normalize_prefix.cpp.
12{
13 static const char tbl[][3] = {
"66",
"67",
"F2",
"F3" };
14 size_t tblNum =
sizeof(
tbl) /
sizeof(
tbl[0]);
15 typedef std::set<std::string> StringSet;
16 StringSet suf;
17
18 size_t pos = 0;
19 for (; pos < line.size(); pos += 2) {
20 bool found = false;
21 for (size_t i = 0; i < tblNum; i++) {
22 if (::memcmp(&line[pos],
tbl[i], 2) == 0) {
23 found = true;
25 break;
26 }
27 }
28 if (!found) break;
29 }
31 for (StringSet::const_iterator i = suf.begin(), e = suf.end(); i != e; ++i) {
33 }
36}