Untitled

 avatar
unknown
d
3 years ago
568 B
8
Indexable
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();
}
Editor is loading...