You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AoC2022_Day6/main.cpp

31 lines
711 B

2 years ago
#define OLC_PGE_APPLICATION
#include "pixelGameEngine.h"
#include "olcutils.h"
using namespace olc;
int main()
{
std::ifstream file("input");
int marker=0;
while (file.good()){
std::string line;
std::getline(file,line);
for (int i=0;i<line.length()-4;i++){
for (int j=0;j<14;j++){
for (int k=0;k<14;k++){
if (j!=k&&line[j+i]==line[k+i]){
goto nextLoop;
}
}
}
std::cout<<"Four chars: "<<line.substr(i,14)<<" Beginning of marker: "<<i+14<<std::endl;
goto endLoop;
nextLoop:;
}
}
endLoop:;
2 years ago
return 0;
}