etl: iteration 1

This commit is contained in:
Dmitry Kokorin 2016-03-07 22:14:50 +03:00
parent 3cb7c2bff1
commit 75da4fb100
2 changed files with 35 additions and 0 deletions

20
cpp/etl/etl.cpp Normal file
View file

@ -0,0 +1,20 @@
#include "etl.h"
#include <cctype>
namespace etl {
using namespace std;
new_score_t transform(const old_score_t &input)
{
new_score_t result;
for (auto pair : input)
for (auto c : pair.second)
result[tolower(c)] = pair.first;
return result;
}
}

15
cpp/etl/etl.h Normal file
View file

@ -0,0 +1,15 @@
#pragma once
#define EXERCISM_RUN_ALL_TESTS
#include <map>
#include <vector>
namespace etl {
typedef std::map<int, std::vector<char>> old_score_t;
typedef std::map<char, int> new_score_t;
new_score_t transform(const old_score_t&);
}