private ArrayList<String> searchWithTwoWildcards(String query) {
        ArrayList<String> res = new ArrayList<>();
        String middlePart = query.substring(
                query.indexOf('*')+1, query.lastIndexOf('*'));
        int i = 0;
        while (query.lastIndexOf('*') != query.length()-1) {
            query = query.substring(1)+query.substring(0, 1);
            i++;
        }
        query = query.substring(query.indexOf('*')+1, query.lastIndexOf('*'));
        for (String elem: searchWithOneWildcards(query)) {
            if(elem.contains(middlePart)) {
                res.add(elem);
            }
        }
        return res;
    }