bruteforce implementation