Initial commit

This commit is contained in:
2021-12-01 20:31:53 +00:00
commit 2f44ccc3a7
106 changed files with 9333 additions and 0 deletions

37
2015/puzzle-10-02.cc Normal file
View File

@@ -0,0 +1,37 @@
#include <cassert>
#include <functional>
#include <iostream>
#include <map>
#include <regex>
#include <set>
#include <string>
#include <variant>
std::string look_and_say(std::string const &s) {
std::string result;
for (std::string::size_type i = 0; i < s.length();) {
unsigned num = 0;
char c = s[i];
while (s[i] == c) {
++i;
++num;
}
result += std::to_string(num) + c;
}
return result;
}
int main(int argc, char **argv) {
for (std::string line; std::getline(std::cin, line);) {
std::cout << "Application 0, length = " << line.length() << ": " << line
<< "\n";
for (int i = 1; i < 51; ++i) {
line = look_and_say(line);
std::cout << "Application " << i << ", length = " << line.length()
<< "\n";
}
std::cout << "Length: " << line.length() << "\n";
}
return 0;
}