From 156f1e7dac0e10365c739b6db7f9ce516348776d Mon Sep 17 00:00:00 2001 From: David Vereb Date: Fri, 6 Dec 2024 16:49:48 -0500 Subject: [PATCH] Retried 2023 Day 1 Part 2 after Becky mentioned we never did it. It isn't optimized, but it's done. --- 2023/1/Makefile | 2 +- 2023/1/{input.txt => data.txt} | 0 2023/1/{input2.txt => data_test.txt} | 0 2023/1/main.cpp | 214 +++--- 2023/1_old/Makefile | 2 + 2023/1_old/input.txt | 1000 ++++++++++++++++++++++++++ 2023/1_old/input2.txt | 7 + 2023/1_old/main.cpp | 134 ++++ 2023/{1 => 1_old}/sample.txt | 0 9 files changed, 1247 insertions(+), 112 deletions(-) rename 2023/1/{input.txt => data.txt} (100%) rename 2023/1/{input2.txt => data_test.txt} (100%) create mode 100644 2023/1_old/Makefile create mode 100644 2023/1_old/input.txt create mode 100644 2023/1_old/input2.txt create mode 100644 2023/1_old/main.cpp rename 2023/{1 => 1_old}/sample.txt (100%) diff --git a/2023/1/Makefile b/2023/1/Makefile index 01c4ef2..638e325 100644 --- a/2023/1/Makefile +++ b/2023/1/Makefile @@ -1,2 +1,2 @@ a.out: main.cpp - clang++ -g -std=c++20 main.cpp + clang++ -std=c++2b -g -O0 main.cpp diff --git a/2023/1/input.txt b/2023/1/data.txt similarity index 100% rename from 2023/1/input.txt rename to 2023/1/data.txt diff --git a/2023/1/input2.txt b/2023/1/data_test.txt similarity index 100% rename from 2023/1/input2.txt rename to 2023/1/data_test.txt diff --git a/2023/1/main.cpp b/2023/1/main.cpp index 31abaf6..784b4b5 100644 --- a/2023/1/main.cpp +++ b/2023/1/main.cpp @@ -1,134 +1,126 @@ -#include +#include #include #include +#include +#include +#include +#include #include -#define INPUT_FILE "input2.txt" - -int ParseNumLine1(const std::string &line); -int ParseNumLine2(const std::string &line); - int main() { - std::ifstream ifs(INPUT_FILE); + const std::string filename = "data.txt"; + std::ifstream ifs(filename); if(!ifs.is_open()) { - std::cerr << "Couldn't open " INPUT_FILE "." << std::endl; + std::cerr << "Missing " << filename << "." << std::endl; return -1; } - long result1 = 0; - long result2 = 0; - for(std::string line = ""; std::getline(ifs, line); ) + unsigned long total = 0; + unsigned long total_pt2 = 0; + + std::map values = { - result1 += ParseNumLine1(line); - result2 += ParseNumLine2(line); - } + { "0", "0" }, + { "1", "1" }, + { "2", "2" }, + { "3", "3" }, + { "4", "4" }, + { "5", "5" }, + { "6", "6" }, + { "7", "7" }, + { "8", "8" }, + { "9", "9" }, +// { "zero", 0 }, + { "one", "1" }, + { "two", "2" }, + { "three", "3" }, + { "four", "4" }, + { "five", "5" }, + { "six", "6" }, + { "seven", "7" }, + { "eight", "8" }, + { "nine", "9" } + }; - std::cout << "Part 1 Result: " << result1 << std::endl; - std::cout << "Part 2 Result: " << result2 << std::endl; - - return 0; -} - -int ParseNumLine1(const std::string &line) -{ - char found[3] = { '\0', '\0', '\0' }; - bool found_first = false; - for(auto &ch : line) - { - if(std::isdigit(ch)) + auto GetDigit = [&](const std::string &line, int i, bool ascending, std::string &result) { + std::vector tests; + if(ascending) { - if(!found_first) - { - found[0] = ch; - found_first = true; - } - - // same as first, if only one - found[1] = ch; - } - } - return std::atoi(found); -} - -int ParseNumLine2(const std::string &line) -{ - char found[3] = { '\0', '\0', '\0' }; - bool found_first = false; - for(auto &ch : line) - { - if(std::isdigit(ch)) - { - if(!found_first) - { - found[0] = ch; - found_first = true; - } - - // same as first, if only one - found[1] = ch; + tests.push_back(line.substr(i, 1)); // single digits + if(i < line.size() - 2) + tests.push_back(line.substr(i, 3)); // three-letter words + if(i < line.size() - 3) + tests.push_back(line.substr(i, 4)); // four-letter words + if(i < line.size() - 4) + tests.push_back(line.substr(i, 5)); // five-letter words } else { - const static std::vector available = { - "one", - "two", - "three", - "four", - "five", - "six", - "seven", - "eight", - "nine", - }; + if(i < line.size() - 4) + tests.push_back(line.substr(i, 5)); // five-letter words + if(i < line.size() - 3) + tests.push_back(line.substr(i, 4)); // four-letter words + if(i < line.size() - 2) + tests.push_back(line.substr(i, 3)); // three-letter words + tests.push_back(line.substr(i, 1)); // single digits + } - int num = 0; - for(auto i = 0; i < line.size(); ++i) + for(auto test : tests) + { + if(values.contains(test)) { - for(auto w = 0; w < available.size(); ++w) - { - const std::string &word = available[w]; - if(line.size() - i < word.size()) - continue; // not enough letters for this word - - bool word_matches = true; - for(auto letter = 0; i + letter < line.size() && word_matches; ++letter) - { - if(line[i + letter] != word[letter]) - { - word_matches = false; - break; - } - if(letter == word.size() - 1) - { - num = w + 1; - // std::cout << "Found: "; - // for(auto a = 0; a <= letter; ++a) - // std::cout << line[i + a]; - // std::cout << " == " << available[w] << " @ " << letter << std::endl; - break; // true! - } - } - if(word_matches) - break; - } - - if(num) - { - if(!found_first) - { - found[0] = num + '0'; - found_first = true; - } - - found[1] = num + '0'; - - num = 0; - } + result = values.at(test); + return true; } } + + return false; + }; + + for(std::string line; std::getline(ifs, line); ) + { + if(line == "") + continue; + + std::string first = ""; + std::string last = ""; + + // first + for(auto i = 0; i < line.size(); ++i) + { + std::string result; + if(GetDigit(line, i, true, result)) + { + first = result; + break; + } + } + if(first == "") + std::cerr << "Missing digit in line: " << line << std::endl; + + // last + for(auto i = 0; i < line.size(); ++i) + { + std::string result; + if(GetDigit(line, line.size() - i - 1, false, result)) + { + last = result; + break; + } + } + if(last == "") + std::cerr << "Missing digit in line: " << line << std::endl; + + std::string val = first + last; + int val_int = std::atoi(val.c_str()); + std::cout << val_int << std::endl; + total_pt2 += val_int; } - std::cout << "Return: " << found << " == " << std::atoi(found) << std::endl; - return std::atoi(found); + + std::cout << " Total: " << total << std::endl; + std::cout << "PT2 Total: " << total_pt2 << std::endl; + + return 0; } diff --git a/2023/1_old/Makefile b/2023/1_old/Makefile new file mode 100644 index 0000000..01c4ef2 --- /dev/null +++ b/2023/1_old/Makefile @@ -0,0 +1,2 @@ +a.out: main.cpp + clang++ -g -std=c++20 main.cpp diff --git a/2023/1_old/input.txt b/2023/1_old/input.txt new file mode 100644 index 0000000..495c9b2 --- /dev/null +++ b/2023/1_old/input.txt @@ -0,0 +1,1000 @@ +four82nine74 +hlpqrdh3 +eightsevenhrsseven988 +324pzonenine +fglpbone79fourvrgcmgklbmthree +fmbbkvthdcdmcjxzclk42six4 +four22xcqsnvktnpfshtmm +qmfsccxsixfivelnmpjqjcsc1sixpfpmeight +eight1nine5nine9six +s4r91seven +6pspkslrnxpplkhgqlcqfour +sixeightnzrzgjvsrnmtqgx5 +sixtwo1 +h6 +five8pbcsllrbvg787 +dpfhfeight28onefourtwo +vxqbtkxjtwoz3seven +8ksrcjrcmpbq9rtvtvrbgljzqvbnxddnzt +mpftpsgp6fourvdmltwojd9 +2fivetwosix +3qqx2 +jsbdh16snnllpvvgnggfive5nhjpgdzh +4fmgmmbonegtsnqfdqt1pm +2onendvlmcrvzsnpr83nine +8ninelfhkhnqtdfour +8reight +84gnprjhr3eightsixsix +1nc7two +3zcgkgrnd1d4 +nmfqfivervqkxmkdpnine51 +1fdtrptkb3 +nineone7kks +ninelzgncpeight966427 +eightrsniner9 +nine7two4 +253slq +lkhthreetwo982rrc +fivegdsfnfour64sixtqfour +dkfdtgnine9 +1six15ninebgnzhtbmlxpnrqoneightfhp +32fivefivexjvckfourseven5seven +onexxzvptxkn42eightvsdgszdjgp +three6sevennine +mvsrflqjsix22lhd2twodkltkmsk +threetnbfsfxxhseven51cjvmkvzkdhr2 +11twoxjszm93 +trr62fivedvktlheight19 +4hxthreepqptvkkzmfsevenfourxeight +5shqhrjtdgsninepblpjprtqptz +ptwone9kzvjhhfive7qjsblztmfvthreeqrhhmbgjpqrgqhcgzntmvskhh +xltqzgqxbkq7krgnthtqbm3636 +nvvxfxbgldrb2seven7twokxzbfkvptflnhlqjrthreeoneights +7fcvckqszbj +eight1ninethreeninenbmcsqtrl7 +zkqmlqmtszrbvnjnvsevennine9sevenqjrlxqjlql +428 +8seven16nineeight +24bkfzsrxjtbzbknqqxtfftzlnrkeight +two372eightnine +skxf5zpnmzqgvzjv9sixtwo +1fivedsghrseven4 +8hmb75twotwo +2hsnpfourthree3h88cz +6qkqxszvghrdslpckhfivedlx +pnxvtbflleightjpfzlqxhr22ckjrnzhnbvdnj1xnfhmb +cdscn4xksngscvnseven +65oneightpln +ninesix11six41seven5twonesl +f411d +sixonedqppgfdfbthree1sj1sevenqhdjlg +eightsixhzshtg5oneone +tbhdgzphkkvbbclmhgvb3three +dpsxdfmzstpd7rzf3 +kzpctbr3oneninevgcxcvsconeightgk +blmpjv6ltxfqsqfjnjgxtseven82 +99four +onexsxs3sixdnfqlffjnnrfive +4sevenzdjvrqjlx33 +brtbqvzcdtlkn83sevenmmtwo +5bnlmjtmeight +twotwofive2fqbfvqhp65eight +dstwoneninekfourphth4lrfjjrh +mqsndqcxt3 +5mbfxskgnh1twoqbxfbcjkzf +6fourzdcmdl78pvxxjrplmtmvhh +3mzgttvpt8gvzoneseven21 +8253fgfhpmponef8 +nineninelhntskjvd25 +1czbccmrlch27three +one4l5four +sixmcnsxf5two +onethree2five7vzhctscktrcx +14szp5fqtqfzcd +6cgpzjprtsjd8five4vjzfhgkbbf9 +7gt +4lzx +fonexgjsnine8 +1twomvdvdrrneight8fivenine +59eightthreesevenctwon5 +2dxfivenqflqppm3bmtmblbkltwomc +36mplfgblgff6 +threeseven8gf9sevennine85 +hfssbghbnonesvdm7onekssjbthxjjvnqmcgmrcx +eightfrbrstlh8 +eight34sevendlhvhszcnvdlvctkdzsgq +seven2eightmtsmflrx2three44rsk +fg6 +mbf44 +5926386nine +48vqvcffsq2eight7zktszfour +djstrfnqsixone8oneightc +5seventwoqtr3eight5 +dttwo88three +8rdxmnrtmt +r2tzcbr867onetwo +2v489four2 +vsmfszr5 +84nxrm48 +5cp4five51three +four3six3 +4zglqmdngeight1sqb +3twosrlvbzfh6nkrhmnjqeightseven +eightgjhs276five +j15one683 +hnnonefvhnxggtwoz2five +threeseven2fourkltqmthree +bmksn4 +11ntrt +5tctbxqjcngdhffqqrjfive +vcstnf1 +98tgzlvtwobjpxj6 +one6j5hqgbvhtmsjkbt7mglhvjjxmtwo +1sixq +three8lbqdd38ljfourtwoccntjgnmv +two5msdsntdrjl4six15tdpnknrxnine +sevenzkbfmqxb2sixsevenbvnbxtxvfournine +1nzdfninednkhghlscsc +onefive3gvjsqqgx7seventhree +8dglgts4slg5sixninevzsj +dxdmkshgssevenfour967ninetwo +4ninevrhsbqnjtwo +358fiveseven +two8sixzt2 +93ninefztjqrhdlxxsjnnflczbsjqpkrmsixtngxqk +ltpnkxtwoeightcfpjhthree5brzhffour +four3five6q645qxn +fourjxqghk6 +8dznl428nine +1djftqndtmkcbptxs22 +27one +543 +qgtbvgnl4tzfgch7zqtmpsix +fourxfgqcsgxbg741922nine +two4sixmkvkftwo5one +lrlnnbdzr82g58fkgvfninezmqv +2xbkhjbrlztnphmcsfcln +2xlxksqkb +rcnzsrtfive9scnnvqx6kmkvgmxlpqtkmbjtvsfmvseven +6oneninekfpnbngn2 +2nnxlthmxqc9eighttcznxdchdthree +dznqtbkgtwo5zpthvsnone +7nxjjzhfhpshccknpbpttrjhqkxmmssvtlxtmbxlhvtjczone5twonecf +96eight +7qvckkdtvzjd +14nine1two +eight87one8ncdzkptqrgtfclsevenc +8fourfive +jjqbpmp42589stwosix +vtrbqpv9sevenone1qlvmzkthnnsevenseven +pxnxptttxh6fourmbpcldrlfnjtcxtwoonefour +8njghfrsix82 +gvns197fsgtwo +9sljnsix8 +rnine7ninethreenjxnrqgzbxbtvrltbss +4stzbqg44f +3ninesevennvvdmgkxzmttcxfbsvjrg +eightsix3twofmnvs +one2fmzxnhhrnvlttxnhbrjsgjsqkvfn5 +qz9ptnxfngfrh65bvvbhtsrsntczgj +qfvqfpb2txnxxd2fiventvznljcqj +fiveqvmzqlgzdbvqzjbllzeight5bgt +qggflvv753clcqqjqmngdm6onefour +3fourfiveeightbbgcgtwo857 +one5nineeightg44 +6zmqxcl16twofivedjxhzmhffive +jnnsixsixtwo2bgsnbrzlnlltb +six63oneightgdg +pftmhdnqdgfive1three42four +8hkcjlskh82 +84 +1ninefour9sxmppxjqqxpn +ndrgrhsp1gxcrfgxctv +fiverzmcmbqd78gqm +fiveeight4 +vxktmrcdlsfiveoneftvqnnvjfour8sixlmldnrceight +hpfprllctdjtwo9ksszn8eightcfdbzz +nine5fourfbgf8one7t +8sqxm5 +6fxcxhn +2prktdcvnine1 +2vqrlpffvjlfourktdhxxgvonedvnsvlld +qk7294fl +sevenfivesevensevensn4 +rnpqmrgczhllzszvkfzmcljzpthree8 +fdcqknlctq74 +1xnvpvfgsbslkkktxxhn +one5eight3zrldkdj +nlvgbz71fourk33 +sixfourfour6three2three +7lszpqqq795nzdfxbzsqlsix +one8nkqdtctsjj +7xfphzjzndr1 +keightwo25hmqthbeight +2sixdm +l4eight1fourfour +2ldzseven3eightmdmsgkrrfivetwobbzz +mtwoneonezdfour22two6 +7fnjbjqdxvkntlfkhkvnzt +dhqsqnslccxgdd63x +nine6fourthree +7qzbrpplm9 +pqbdbxxxggn9fivebfttnine +58h152eightjmjqlzjjp +8vjrtblqzsx +7sevenonesevenhqkvxxsvrsix +four6hcxdtwozjnpsdtpzxxninevzvsxffxpctcjbtmlm +3xznljnjz4ms3seven +8892 +3jrzlmpnxhfivefivetwoseven7 +onethreetjpmpvpr6threethreeone +one5thcfourndbphpxszjmt7eightwof +r5s +fmjzjqlnhxqhvbdvdfbdnb4 +nine9mrqdgnkc +nm5jxpjgsm31stkvxjseven5 +hplgpfrtlb8dgsbbljfdgknfvqbonexbcddflz +4bmfrjvj81vvnztchfrjfive +xvvb2nfqxdmpzjvrbmvvtmc16 +txrfivecjq6hlgjbvzp3threefourone +sixlthreeeightn9hqmxhxfjrb15 +six6eightone3 +9six7 +nineoneseven2eightbr5nine +sixqqdsdmtkgkfq9 +3fivefiveffive +8eightfive2six +7rnlhrhlfive +kvkrxgkk6one2ninermqtpbbnmpdpjxc +nhltwonesix3five3two45sixk +eightsmjnzfzjk8 +sixhxsprkfour5b9 +vkvhvhrvbnvz7rg944 +ccvzjppvjtthreetwoqdc4eight +threefive9qlg3hkhvrbdxzdthree11 +onesevenczvffoureight28 +three39jddkzzjninetwo5 +63nine3sixlqnbtrq7jctmgdmk +zxsqngxxfd9rvjjt14978five +9983eight +sevenddfpzjp3skz +bzdpg73eight71ppzkeight3 +onevphctjs4 +twofive2jxsthree8sixqeightwozrv +6klpdhhsdng +thxtwonefive57rpseven2 +qtcdgdfj77sixrhtczdcbp3 +seventhree47 +threekjqqht883 +two3jfgsdnqbxcbzjtteight +5zcpgcgsixdskfszmmq9hxtknineqmhg8 +snjs1lxkpbk5 +seventwo7bknk9 +rstbvlzlk1tpqjsjmhgdcvpfdqzl2bcbtn +3eight4six2 +twonine8xkqp3eightgheightxplcqbvppj +ninevkrvzvseven6eightcmmvgzb +77n7fourthreecrcq +xlvszfhhffhmvxfour8skpvl +9nine3kfhgngkd1 +sevenfivesxdxhtkmeight4 +28four92 +mjzm465qffive9 +dqlghfxbkfourfivegfkmgmdgzxtm1 +six13lrc +8qbvnhbplbl6 +13lmgbfsgnxone1 +ttdznnjsgjtwo5 +eightfourtwotwoltjxfourone3 +8threethreeeighthbbxfbmpj611 +ninekpjcrvlqbmsixseven5four +8jmgspsevenfour7 +6nineone5hthbrbsjrhbnn2 +ninezzdlfiveseven4 +fhrxvsevenlvnztq4one +cvmlmzz8njtfztfzfoneonejbckeight6 +ninexdgtgjjnrb1hrhjvchm +63gqjvjtmzgkpbfthreesix +fkstfchxcbrkfivemzhfdhsffd4mnbbmgprxcgmsl +87rslqkvbzncfxddt +7fiveeightxqjhdkbbgdjksn +four375 +sixftdrnbzq84688three +eightseven8kqdcbgtmvlsvxx24fqrfp +four7vprrmq91 +six85ndzvnplxhkmrjftsixeight +5twofourzfdxbffive +4jbvmpnqcpbdfrkzone9ndcxtgsfive +nine3jzpsrhb +nine6cpqsfour +78kzczxbcthreesixxtdkflhzfour5 +14sixsevennzgfnmppnmcddd9six +fourncvgmhfl2fivefnlndmj +rzgqvdgksz6six +23seven2rhlv5 +9xlnnvnvccj +3fivethreembplpfdjnineseven2 +jk1 +3threevgklhnnnccrmone2 +threefourfive4 +qtpbdrsix67threekslkmqt +five3ghvqnrhtbqnvtmdlnine +84lvnfx9nine +nine7onethree46 +vtshvtcch5kxkzgkfourrtmbq +5czsbzl3threeeighttwo +38nine +twovcxn9sixklflgptlkt +fcjpjrxdleight87 +cfn6 +sixfourtpzpnsvghlqp3ssptlls +trsjxmzvhxgvtzrhxqbb66nfp1knf +twosevenmdmmcjjgxj96qxrqqteight +sfcpfs9dpkvxrmjfiveseven +6dblskzfsrpcnszqtwo9rgrdkjshb5three +5fourfsblzr3onesix +gcxsc9 +txjtwone12 +twovpgthxxrpsevenqxpmlbrr3three5 +csqkgmzl93xrxjs64gptsix +33qjjzgjtrsflgpr6 +twoeightseven6zdtdltvzsxvlgsevensixpmxlfrb +gjnvdxbveightone8two +24vjdfhninezfvlgrdvsh8 +ninehn1685nineone +twoonegsix4threeninezrsnvrltqlms +5cdfdldjxddrjhncxtsndl8 +1mqg3nspfxnkfoursix9nine +1tfcrfpqmk1stfrrnrz +721dgsmsixjtxcxmj4jhkdsfj +9plbxnrnlgsvtshfgzbkfive5qfbzgrxzk +fourgjdt2 +ninethreeqqxrjjgskm1fourseven6 +rbrr1 +threekrslrrqngjtwo6 +llkbxgqp2cmnmgdfgrcshlmseightgjzs +66sixeightthree +64vdnrrqfxonespgfhzdcdrbrqone +threervnhkgdg7oneeight +nkbrvsvlzkonermsvxh65dlvxbxvlnq8 +twozbkclqppd9txxzbvfppz3 +two9nine +7vnlqfgxlmninek2two +qjzggvqj1ninefourrc2szbmczr +seven6kfkkm7 +nqlgfzmdfsevenshvcnxdjvxveightfour9 +seventdrqkrxkeight75qjfbb44 +four3cxhlvthree3tcvrzk +six5seven2 +3ninehcsjfstwo5xsgmkz6 +3fourlnthree1fourseven +lsxzsskbsqmeightcrddxvxk93fivevfshztv +nxqxrsevenl3eight +239fourjcrffkeightfivezmfsvqvpz2 +hprcp6 +rklbzvhll4nstdjb7fourthreeonefour +9jlnthv +65six4dvtftwo +nine5five3kqvrs183 +sixrgtckzc7nmczdx8three2 +4six61pzjhnhpbnmsq +1fivembsixsevenddmrlkfour1 +qhgxrbnfc8one2vxc +rdsttzt1sixonefive +lsdoneight5pmlztbkvzffourfour7 +7g3 +3sevenlnjfvms9two +dclkonefour5 +tskeightwo9one25ddmdmkqrpffoureight2 +rmkqgbh1slrtshgkgbdsftvbgm4 +qkhxmpfzf51 +648 +three4gfnxzrs2 +hmcskdltfourllp7sixfiveszgnfbpjt +hf27ninep1fqdbglxngkf7 +seven6bfhtdztzvqhqnj2xfxchxpfc9 +8vfksvbfive9lxjhcfive +626txvseventwo +1bgzkmzx1 +nineeightlzv2l +8ninetwo68twohhntdvjpzfone +jsjfive535fdfnj3 +fnzrsevenhcgzccslt92twonine71 +4twothreemx +6vbtgjssfoneqpsrdfrbcgmrfckfourpzdlb +91svfsxrseight +nzmnpbdqjdh2four +blqjhjxplrxsevenonefive13 +fivef11gtdpgbdrxnbtrfqxfb7r +l5fivethreenine +oneffcdpqmvpcdcn6six944 +4mmfjltf7 +29threenine26 +8zrthtv56 +c21hxksz +nqcbjkb7 +fourxtkrn7bvpbqtcg78 +qjvmvzbkxlseven756 +6g31dk1mnsgxhbdvndjgvsjr +73eight +61jlzgrrpkvgdpjzbbqkxp +3368nineeightwodzl +9tlqcrxsix7 +cmrrnf8five1 +4three72 +hhcghmtvznine6nineseventwo +22tvjnfvzshdtpxzxrnzvtwo +8threeqlkxrkfsevenfivegxmbhqg +5mzzsldbk7ninefourjfjv +rloneightcjhxsstwotwombktzlkdxtwo8 +three92nine1sixeightwof +drxgb14twoone +7one7seven258nineoneighthkd +4four4sixninem +fivejkjpdbfpsttjnpkv4one8phckjllc +5bmeighteightgkjfkjthree +98lkzpdnvs7chnmkxzql +twosix2two15xzkpmctwo +951 +four481six +3tdvlonefiveone +88fourgktxksmhninecfpljsix +cphlzlx45fourxjphtthree +6eight4gfjjdvslqv1six1kxlmn2eightwof +5vxrzxgdpg7vrsrxrrhncfour +5threethreemrzfbjq +ninecsg9lseven828bjttzx +5kqnine +fivetdhxq39 +rcvlsix6pqzsggz59 +47fnrs +724onesixtwo +tdbb7 +sevenseven4 +two7mlzgdqthree +2gxzbnlrglnvmqmzbznfngxfeightnrcrqsjnftfourone +fivetwovsbvrfour2ndmltmprsqkbbztwo +j3twoc6mmzt +six47nine6tkpjleightwopzf +sevenmshrczkdqfiverkmhlqjzqqhgppbsm58 +pkbgvlvzckvone26rfqbmtwo6 +sr9qsxjnine9zbc6three +eight4qxlmtwo27threesix6 +fourone417oneone +6fpvfbrrtwoeight +79rj4eight88 +6vhfivevrj +7tmqhchfive6jxgmqcfmq59eight +threeone3xqcrjzszhseven2csbflgnds +1qsxxxmsknhseven3nine +fivemqxjlggcnsngflb5qtshllseven1onefive +7476qfcmqqbfhvrvksfztskmzgvjjsrsc +twosxlbrgdtptwo16 +kffmtjnjjk2fourtgv6rvsrzcvdrklplndseven +eightzhrfgpjfqgccn2khrfdzfour28 +ninetwoxvnhfdjsxslone4four +92nine48b +ptwonefourclthree56 +hshqjfknineeightlkdxvxcsljfptlbb6kt +fxjbr1four +nine36gqbt6 +nsbcvzninebvlpvlx1three +1ltlxzlmzxhjlfvtnrrpdk +3jpqgspseven5qm +553npbeightxf +fourbspjfbxk4 +238 +xjrsdsvgncxddpmj3tlqone89 +68bkvsslntwo +dxcmpjfprnthree98sbh +reightwoeightseven76xqfhvbkfouronegkrfvdzzdx +9lfpjff +gcvs5 +hnctpgpxdlvklfsdfour2hnvtklhgqxhjpzknine +ceightwoninefivetwo9plndfive4 +pjnzdrhtddjgllbf9f25eightb +fpsdpfl8cnhkjtzhfbhdftkvm +3cqqkflmjmpfmkk79lvkjljd71 +bfpfmkjpnkgspsz7nine +threethreetmpntmpg3lfzzsrzr36plfvxv +nvssix83 +dznrcvvgb8 +csrffxrtvmpfgbkcmmdlzxneightzvfgxdpljpcnrcn5 +9sixtxxthree +seveneight2kpzpvvtzq8 +jbmmeighttwo12seven96bcvcs +b68pvjcsnine8 +4vphtk7 +mxmjvnbqseven2 +3two2foureightxvvtxpcdmsdzvkg2mthmx +cxslpdtnnx5five65 +97mp3qbkxmhl5dkphzgmpg5 +7f11sixcnrqone +8fxjdjxc6drjxnhptdeightseven1six +sixffvgcsfourhmnrf8 +qtpjrmlgnlkbbbr7sjcpm91five3 +5pqv69one +eightnine8 +1three8 +39cspknxbsjhtfourpcbqsvlgz +5nine15 +zgjgjfcdphnqqv4eightsixsevenkv +6ggfxblx47nine2onenine +1twoone2xfxfcr5 +sjvpxd7ncpclnc57one1 +4sixdgone +89ptctqvnpg +threefour1four4 +8seven5pfeightfive8hclpxjgftc3 +mznfsbmdtltwoqlf9 +425 +n51891 +one5l +8ninefive2jhhbnjsvdqtlmsjgshvlvlh +58ggdlkpcmkgeight2vcprcttwo +twoseven3eightfivesevend +krrzfivexrmvdtbr1zvqpmthreeonenqnmx +2sixhjpxptnthreezkfsix +jchkkkgrdmkvdgksevensevenfour8five6 +1tzbzthree +xkone7zvgtv5qvln +6fivetwohjblzsixnine +onelpgkpggl9nsdxtgh4tgjfgpcsn3 +bjdxc7krrt16xbgvl +sevenrpftshchmkkflxseven4eightsix +groneightfftfvk6 +hrcshqtxpqgxeightsix1xxxrczpcr +foureightthree9sdffivebdtrng +ninefourthree9eighttwonine7xjrsm +fivefour64 +51onefivetkcdbbslzmeighttwo8 +4rssgjpzgnczqtdrfivesix7bjxslhzthreefive +5kgkv7ninethree +84ninepsbvzkgrvqpzmtqgmcxpvgfbffns +fourrvdzsntddfoursevenqq54lgdrtdcq +4nineeightfdh +9twoonefour2kmnb9 +qcvmnq13tsptksgmqj8 +113twonine4zjsbtjkpbdsix +sevencvnineq6jvnshmg +pjhmbnjqflvp452sevenfive69 +2three1sixninekmfcsbsevenfive3oneightg +six3six62onevrhtsskzrhtthree +5bxcmdnrf1szdgfournine +fourxdxmk6 +3lsnfgffnlrqboneeight +9sfsv4gqhpbqg86 +two17567fournqkmh +7threesevenzgxvkhf +vlmz7sevenfourfour8bqzdrdktklfivefq +xxsvcqqeight6flrffzxpfourkzfstj9 +fourlzpdxg3knxgl +msb246fourlc1crhlbjgdgr6 +1q1cmrmqponeightd +twoeightncz513 +nine1nine +8sixonesixnine +193sixthree2rgthk +tvhqp44hmjhzvmhgrbprgttgrt +52bdszlvsvgzonefiveeight +sdxnpkllmnninethree5jxsgkdbmknfrfvthree2 +six23hdzmppf67threeseven +eight5nine76vbggdlp +4onevrxnnbszk +9ninezhdsfbfive12 +sixnine5xqmkmthz +fiveskklnrr13sevenfour3nqs1 +sixqcxqnjxxzqmdlqtwo83 +8eight7 +9psvqdzpchr +492jseven1 +xrccslcthreetsnfoursixsixsix1 +gskqmvnclfgxbtcq9hsix +5two4twofive +sqqhrvtszzjs1vfskhsdsvvhlskn +nineseveneightcjcgnb9three3xfkst8 +ktwone4one73 +five6xncdddspkcbgklzlzn687 +xgnlvnskgklcpdqvks2 +zscmhb7mrrshccm +five8hplscnineeight +2hrgc86dsgjbvsrv9 +8lncmqrxcnm9ctpxjxlz8 +jdqt39336 +1gntnqbstzrnine5cqlrrtfllb13kfleight +3jscjlvvkd89 +5nineseven66nine6twoonetwonek +sevenxrqj4bfivesix1 +8msix8 +six6ninesevenfourbttvtt66 +4cmvvdfdgqphjzleight +55mltlnxc4dmcrhjsjc8seven +26197jtlvpsixcmzkslvzh +rjzn2 +krlvgxone54hdddkspmfkpnzcbtbz +four2two2 +one5vjjs3one6six +6cmt88three +reightwo7lrjqxbmgjj3seven2 +ntrkndgqzpfkjrone9 +5dvktjpseightxxmbtrm +four6seven9936six7 +fourhqstnjbbdscjngp5fpxmg +77five +qrzg9five1qqcsonekgvckmmpfx6mpxd +qzjqstcll7donekkpmkgpdthkjclrpth +14seven +bpbfnnq4rpppcjfeightsfcsqzg +2one7eighttwo2vhzhjpgg9xhsdvlgxf +eightonepn38ztcqzbthjz8 +lnsix7eightskqhrbx +sixvnpkpsdzsbjgjkbxreight8five4 +vfrvkmnvnhk5one +eight9nine7 +oneone5 +7584zprfmjtwo1 +4szpqtwoflcr9bhtthreeeight5 +385 +ninekdqknptxhsevenmrmjzqjvnppsrgbkv9jeight7 +5fs1sixeightthree +sevenxkvxzqhckfourninetwo3eight +9eightgfjvv +xh8 +brbs3fiverzrtwo4jtdsvrljxone +qcvfnlvfivetwofourgsdlcmkb5 +klnsqmblkffsq4threetwo6 +nine4eightx8eightwohrk +c1 +sevennine55eightttlbshbfive3 +6ssmtjnxsixthreengrlndcb3 +vgpq8sixsix +96xhrnine9 +grpsjz1zqzthreeone2four +r6twosevenrdmczdz +jdjz4ninefour +one88 +ninerzdfc8rxnfbpndznctqd4tlb +cshoneightnbdfmpdh2fnvjtxtshseven +gtpljthree1six +63eightfournncq +twoonegsdpfkfqdf7 +xccnnscfivexbqmxfouroneeightgvndxgnine3 +mktvsff76bfqkq9fivetwo8lv +3four5 +qhdgmcninethreevssbxqbsd35 +one6mprksdcz6hpxhrdznfpkmp +six55ninernnmmlgmblttbgph8pqrjtjhtdj +jnpbmnbqonemjcsgbg1 +9eightfourmkknzgmqh7two +7five9 +2eight44skdlfbhfsshpvhgfseven +2cqrzrhbfn +three8419two7 +rvpblkzgkmxkghsbfn3one +nine58 +74spkcfzsdmkf2six1 +2threeseven +sf84qnthree5bmxnrmqff3seven +oneonecxxv96 +gpdbgxgjqzdzlxgqphdr63twofourkspvxmvrfx +fivesflg9fivesixonexfb1 +8pc56fourqpqmfour2eight +3qvgqqldcr8 +tssixfourlbqstcmj1 +pf2sixpzxcpmxtp7twoseven +5429 +drtlhzlqltwosevenfivetwo29 +eightlqtfronebqhdh1nineonembxnbpgg +vlvnzcpbpqeightjspbbqqeight6 +sixkkmgcnhdfldplzk3five +93ninekcmgjm8ckqjdz +3dmskrqjd9 +five5threefivesix +lgvbpdnp8oneeight7eight +seven37 +2onesixtgbqbnn9eight +5ndhfjrvt5fivetrhzsmqtwo +bdcrhzdr33ninefive9 +cgsdzcninetwofive6one +fiveljbtcqcqdglvjnd8onefour +two2b5lzbjsqx7 +three593sevenfivetwovptpnmxffrkbsp +sixonesixthree8btmzlnkvxt +2jf59 +eightfivethreenine57qpdkcfr +eightsix31threeeight512 +fourseven2twoninenineeightone +pqtnqdtsix1 +3zpnvhlsjcmcdvzzlqp5 +sixvnmhckrzxfmjglc964nine +mftxdnhdzmfnrgvvz59nlhhvr7spjrh +eightls148mmvsjjldzlmvxjd +3five5mlfhszsevensixthree +4zpllkssevenfourtgbhdkltwoc +ffourhnjhmtxxfjg511 +63jddsfqsmjdmgxnthree3four +eight3onetwotwo7 +fmfour9tvfourfourtwonef +qseven91two2fgnzcjnm +rpzmsseven1jcxvxgnvthreeeight +onefourrflrntpkskseven1kthreetwo +5lpmhn1six +ttvdgvf67btpqbslt +3twovkbrhqsmv2lzggdlbfvgonenine +rstknqvqtwo55sixjpzmgjsm +nkgfnrxzj7jszsixfiveeightsixfourflqlzmhl +sevenbbbmdgbv9oneightqg +mzmksix42oneonexxmndklncn3bqj +3xxcsfonefour +1threeeightnine46zzscxblntplpd +6four77sneight +pcjxrxtwoseven71threethree +5spmqztljvbtthreefivenineonesl +6zlkxrbhlgf6 +228 +2seventhreesixfoursrhxxrcd +vhkkr33 +twokzcchqdmpf3 +qrz9 +8lfkxtknx +76n +dpxthreeqgtjsqs33pzjxgrmtck +1xhhdhqv6sixlcgfour +four9chmvmrqmfq +one5cvxtvjc96three3 +one6eight +sevenxdncpgzqqv6five9 +fnlrctrph4mpdninetwo4threedm +one3nine5two +8prrdscmtgfivecsnxjrpssix56 +foursclkcvrkvkhrbnnchlsbllfive6djnprhmkxfnine +five2twojknineddzszxsgxxgzfour +9532chktx5 +two47 +42sscxflsevenjssjmzn3xgzpvfsneight +7fltzgtkmqkgjj +1one5six +6gstggspddlninezrzcl5eightqdvjlgz +eight2stxftmtsbn +vqpqvbjvgklxrtvnkgsvlljgxlpxthkeight8fp +sixpjhzscgthree8eight +vgxfxhssbsixfivehxllx9 +nrszzljfrthree8 +dvthfklrvtworxtvhljnsqnbcnpj5eight53 +76threeqclnine +eightvdc7one2four +46five1threeeight3six +five52k557sixxctdrb +hk2twoggmfchleightxnshxrcvncbxvrzhone7 +21rpnnttwo4fivefivedvtpfmnbmg +onetkgkv14sixdjfznpdrvl +onezctthreemfnqcczxpffz2six5 +kzeightwovrtjp94vhn9mjlrxqm9xdzbvgqfqt +34one17hl +9332r +zeightwottpsrgnljcmnglbfsxdkgffrlgm6jnzvkxn9 +pmzdljpgsix7 +zmhxkpskqzgrkptwofour4 +pkoneightsix7 +9695tfivexmspcgz +ninerrlfckbs7vcmbhkninelbhfclninesevenbppk +78k2qhvkzgkgkskhfiveone8 +ndxnqczhlkdvd97threeseven +jmmdfvftbeightone8eight1twosevenseven +five9six98grthvvqdjbrkxn1 +4qxvqfrkgnfcxkkdm1mnczs +n3b +three9bzfour57 +8threexkglxf2 +onedxfivedxvgxjmzkone3kbmplxbkdnpknjzrbmt +nine3two9fivefrmjgxkrtrmzh +tlgpkzfdlnine9fivezdl +9fourtsnhlf5ljxrhflckjrrzfjbndhlcbv +3tthree6zqrhbpqczsixrgvlcpm5 +twosixnzqtvhhnm8 +five6one6 +4fournine946nine7 +one8rzlnlcvdseven4seven +tnmkgnbrzg5nmlqsevenone7oneeight +eight985sjrfjdhtkrbd +4threexlm6twoone5mthree +four8fiveghddxqlp +1kjtrpktpkq +2grqpqfsclsgdzmkglxbzxcshrs811one +9seven94ffkfdmvxr +8tvnnbpj7bjmvlnnj +sixthreeflggjxmlk54 +6five6ninecjdmkggsixnine +sfjlhbbx6onexxjsix4z +9bbnhtpgbntzlxct85 +2bltznvqgs8sixsix +nms7vst8 +eight9vnrqbv +two663 +1h6prckcqdqn +2ninesevensixtwogkvtjrp6rbgc +sbsncmpsixhfvttwo27fsb +fourtwoshvjffjdeight83knlxbdjphsn +bkbhjcgkjbcgjsix1 +cfkpjctlnztlsgjonehrmvtl7vksr +8eightphhd +6eighttwosix5one +8dtnqgtrddjfqmlrptphfxkcgoneeight7 +32eightjfgtqjllmxtf6s +twovqnctjcvsdfjbhtnzccd2gshchnhrpx +twovqqpbrf9 +four4onelkjf15psdspgvvdfcvmnkhmfive +xdpg4ninetsbrmpqfive +fiveonefive19 +46qtppz +twoseveneighteight72 +fivefourthreesevenbxtpqctslbkeight2qmvgth +355ncxjffxt +eight4zslht5six +sdnsrghmbxxjhjqd1njqjcghsspmggzd2 +vcthxnqqkvqsjrkxrs71onetwo +fivexcjvm9 +3kddthreehfhjmq9ninesix6 +rclqzddvxtm2nineninethreefour +vlfgxbkdgnxrsprd386onethreetwo +5sixjscbvzkxtl5fourone +317dnqnqntwo65jnthjbxnfive +mxtwonethreetwo2ninefour35lnhczqfpt4 +nlctnjrr9twopthreefmxgjeightwofqh +nz8threefourbhcjvssgcnine +sevensixzspvzjseven9 +six6onetwocnvmjfour4eightone +7xfd5qlmtzhhgr +8twonesch +nineqvlsrfpdn2 +ptrfgdnine7gpxsix +pfx4sixfoursix4fivesix +68lqzp +nine53jmtsxjptgmzpfoureight31 +two1msjf8 +gpgrpptthreetwomfrmkszrv8 +3five4 +threelqgs2kjvlsbmjkf +4fourzgqkfhqhvhpgfkt +jnlbcbgrp7 +onecdcmbrqxxlpbd1rthree +99mbfdcgbhv +nine6cvmfourfivesixhcsqfpxkdk +eighthjbqsbz6ndpkdlnpmpxqvpmsrbvksnnleightnzxmjg +gvvpnfzbb7zxfschnrteight6two5tnp +sixrctqxdpkxpfdkglvthreenine47rzs +jtwonefour8rkmtclhlf97fqpjmggtztwo +slmfjkfgbjt6 +8lbh +eightnqtfvvm2 +vseven31 +one54qrnzfrbdqfive +8twokfivel9 +vfcsqvxkdxfiveqdvgqdmstn5 +5l63 +two8fourzskrqbcszfzbchlh9ldcp6 +hqhszsgmqzlksq5 +sb6fivefourpmtptjtkzhbxjjnqsixkt9 +twohrktppz5sevenhppmnjzlrkdqddsgs +two37ninefive +fourllczb9 +sixfourone83two +ktgpc7 +fjsnkdj6sixsixtworlhgnbqlbm +51zscxpk6onesevenjxxzcp6hqrtjmhqpk +dmxfcfmfsbfpjfive4 +one47 +9jdlkcpzsevengfddvzxdnfkxf8 +fourdxnine3four39 +nine1one7fjcjjckngthreec +5dlqjlbpt +twooneeight9gf6zvtsqvrlnf +three3six7 +3jnhfivethree +1pzdqvjftwofive348 +four7kcrqkf9 +9cxglsdg +twobgmghbrqdngthreervxjbmp7xvrskhfcf +cpvhhkgmftttdtwoqfncthree1tzlbqcr5 +kmxqkfmlgtmztzpr74ninebqgcjkksljrphc +mrsmtdhpsixslxg9five7 +53two +xpfzv3 +twosdjhone551twozgqc4 +89fourfournfhc +five7chqddxtwo1tjmlhqsix +dkrnxgh5xqzcnjzrhg +lcvfqpglmntwo1sixthreevdndckjgpkzpsp +foursixnineseven1llbdvckff +6four15fivettfivefive +684cfnqfxkxgeightnfgqqmthreelbfxxdsmn +fourdcxxseven28hxqqfhxtd +1threegjffmjrfxppnsqthree +3khnfmcmtj33 +9ninejvdl88 +3four9seven8fourmpjpkn7 +tmfourkc1sixfournglfl +24xgscdtfxhttglvhczrstpfcjvnine2fiveone +psqoneight4twojxkcvgdteight1rhcgmkmmjbbnzdhqj +sfrgqk1two +fiverzjbzssone4nineninefive +twonineonergqsg2eight7eightwolf +rztthree6sixsixxsxtvjthree +78fourcvthree +17hjphkdthree +tdprffbgqseven7 +58eightbchzffmkhh8twofivethree +zpbfstbb71hgldfkrvfourthreeonesixfour +fiveseven1eightnine +four8nine4vxpfpgxtlfhcrndscfgn4seven +pgtznpnqvm1one1dfsix16 +ddffoureightpmqkznnseven75two +6lklqx1sevenzhfdb1 +mq113scstpnnveightfive3nine +threetwox79 +284mrsixthreefour +1seven7zk4lldz2 +271nine2fourfive9 +fourthree37xxkvlgsixzpkblnine +xbbnj2eight33 +seven5sevenonekzpnhzx +247xgmlnntrcsixbstnine +3ninezxtbqbfgtdjpgmjv +tvxkssrfthree3 +fourfoureight12 +onefdszsvrzt2fdeightzkbmz +cqrqkfgb3sevenqtqntxxhqlvrcthreefour +2one5ptslgxsp4six4two6 +rskmbsfglone913vlmqtmpvfsevenp +7c +nkzrdb66crhk +onevdttzljsmzvvhlf1tzqsqnnchdxbmngtlzzjdszvlvfzhx +eightbtstrjzmfmzvcgsbgfxfour4one1 +pttthttfftkp41 +two9rlqrxvsevenfive +v2four4 +two2one +rdvhthhzrmeight5jtgf +flshgbbtztkjfive8 +7sfc181fivefive +fivenine1bfnchprbsix +six2zpqshtndsgsevenone3one4 +fq8 +seven4eightvzfq7kthqh +4vxtllmlnine8gsqkngfdzeight +vhfzmbgseven5 +skqfzlconefivertzchfkvthreeeightfive22 +72oneeightone +7ccs8vjx7vvszsn +xrtmgqk95five849 +threebqeight8hg +drdhjjtdrdxonenineninefourfkzrrggvz97 +8xxldtmdctllqssgdqp83 +dfqrjzv9rqbtn6 +3ninenhgqkglfvjbmgcdrsbhfournine +five821 +54foursix7pv2qsix +7197threescjkqhpqvzgjthpmcgtzrcd +ltpzstwo78fivefourstwox +mcqcmxxzcmpzrz4ntgnsgqbqjmkzpqvxtvsixrzzr3seven +foursixfourzrnxsixgpx7eight +41448sevenhxjpbvhvlmqrpjsvhblts +1geightgtxlzdmpprjvg856five +2tgrll648four +3pkcd6eight948 +94sfznqjqlkvfjgczm +twockgseven4seven6bp +sixsix6eightsixeight +nine3threenpsmshnchm +threemqfptponesevendbjs17 +2ninehnsnnvj21fkeightwodmz +jcptspngbc38nvtnrmvqtwo1 +6qsmcvfoursmlsevensix4lkpxxcnk +xmtjrsrkjd5 +7psvffqn4 +3sh +jdklghtbz1eightrhvfmnlknlghg77 +62tbtjfkltkdrxsxhhxpvbfvpnrpflh +fpctmmvvnbftv2 +nkxmdshm5twoseven672 +88788jnscmpqr66sxcjx diff --git a/2023/1_old/input2.txt b/2023/1_old/input2.txt new file mode 100644 index 0000000..41aa89c --- /dev/null +++ b/2023/1_old/input2.txt @@ -0,0 +1,7 @@ +two1nine +eightwothree +abcone2threexyz +xtwone3four +4nineeightseven2 +zoneight234 +7pqrstsixteen diff --git a/2023/1_old/main.cpp b/2023/1_old/main.cpp new file mode 100644 index 0000000..31abaf6 --- /dev/null +++ b/2023/1_old/main.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include + +#define INPUT_FILE "input2.txt" + +int ParseNumLine1(const std::string &line); +int ParseNumLine2(const std::string &line); + +int main() +{ + std::ifstream ifs(INPUT_FILE); + if(!ifs.is_open()) + { + std::cerr << "Couldn't open " INPUT_FILE "." << std::endl; + return -1; + } + + long result1 = 0; + long result2 = 0; + for(std::string line = ""; std::getline(ifs, line); ) + { + result1 += ParseNumLine1(line); + result2 += ParseNumLine2(line); + } + + std::cout << "Part 1 Result: " << result1 << std::endl; + std::cout << "Part 2 Result: " << result2 << std::endl; + + return 0; +} + +int ParseNumLine1(const std::string &line) +{ + char found[3] = { '\0', '\0', '\0' }; + bool found_first = false; + for(auto &ch : line) + { + if(std::isdigit(ch)) + { + if(!found_first) + { + found[0] = ch; + found_first = true; + } + + // same as first, if only one + found[1] = ch; + } + } + return std::atoi(found); +} + +int ParseNumLine2(const std::string &line) +{ + char found[3] = { '\0', '\0', '\0' }; + bool found_first = false; + for(auto &ch : line) + { + if(std::isdigit(ch)) + { + if(!found_first) + { + found[0] = ch; + found_first = true; + } + + // same as first, if only one + found[1] = ch; + } + else + { + const static std::vector available = { + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + }; + + int num = 0; + for(auto i = 0; i < line.size(); ++i) + { + for(auto w = 0; w < available.size(); ++w) + { + const std::string &word = available[w]; + if(line.size() - i < word.size()) + continue; // not enough letters for this word + + bool word_matches = true; + for(auto letter = 0; i + letter < line.size() && word_matches; ++letter) + { + if(line[i + letter] != word[letter]) + { + word_matches = false; + break; + } + if(letter == word.size() - 1) + { + num = w + 1; + // std::cout << "Found: "; + // for(auto a = 0; a <= letter; ++a) + // std::cout << line[i + a]; + // std::cout << " == " << available[w] << " @ " << letter << std::endl; + break; // true! + } + } + if(word_matches) + break; + } + + if(num) + { + if(!found_first) + { + found[0] = num + '0'; + found_first = true; + } + + found[1] = num + '0'; + + num = 0; + } + } + } + } + std::cout << "Return: " << found << " == " << std::atoi(found) << std::endl; + return std::atoi(found); +} diff --git a/2023/1/sample.txt b/2023/1_old/sample.txt similarity index 100% rename from 2023/1/sample.txt rename to 2023/1_old/sample.txt