Untitled

mail@pastecode.io avatar
unknown
d
2 years ago
568 B
5
Indexable
Never
import std.stdio;
import std.format;
import std.array;

int DIFFCHAR = 14;

void main()
{
    File input = File("../input6", "r");
    string line = input.readln().replace("\n", "");
    foreach(i; 0 .. line.length-DIFFCHAR){
        auto window = line[i..i+DIFFCHAR];
        bool identical = false;
        foreach(j, c; window){
            foreach(k, c2; window){
                identical = identical || (j != k && c == c2);
            }
        }
        if (!identical){
            writeln(i+DIFFCHAR);
            break;
        }
    }
    input.close();
}