Q:

LeetCode Word Break, fail on Online Judge but pass Online test

I met a problem when I was doing leetcode 139, word break.
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. (each dictionary word can be used multiple times.)
For example, given
s = "leetcode",
dict = ["leet", "code"].
Return true because "leetcode" can be segmented as "leet code".
I use basic dynamic programming algorithm, but may implement it in a different way from the popular one on the internet.
Here is the code:
class Solution {
public:
    bool wordBreak(string s, unordered_set<string>& wordDict) {
        int strlen = s.length();
        if(0 == strlen)  return true;
        vector<bool> sepable(false, strlen);
        for(int i = 0; i < strlen; ++i) {
            if(wordDict.count(s.substr(0,i+1)) > 0) {
                sepable[i] = true;
                continue;
            }
            for(int j = 0; j < i; ++j) {
                if(sepable[j] && wordDict.count(s.substr(j+1,i-j)) > 0) {
                    sepable[i] = true;
                    break;
                }
            }
        }
        return sepable[strlen-1];
    }
};

When I ran online judge, it fails at the test:" "aaaaaaa" ["aaaa","aa"]", my code output true, the expected answer is false. However, if I run it on online test, it gives the right output. Also, it works fine on my own virtual machine with clang++. 
The difference between online judge and online test is that each online test is only one test. Online judge contains many tests and will fail if anyone of the tests fails. So the problem of my code may lay like this: at some test other than the "aaaaaaa", it gives the right output but cause some potential problem. And that is why my code will fail on "aaaaaaa". However, if I just run this single test, it is fine.
The leetcode website says it may because my code has some undefined behaviors. The previous test case may influence the latter one. I don't know what are all the previous test case and didn't expect anyone here know about it. But I think as long as there are problems in my code, someone can find it.
I think the question is pretty clear this time.

A:

this line parameters are of wrong order vector<bool> sepable(false, strlen); it should be vector<bool> sepable(strlen,false);the length of the vector comes first then the default value and false is implicitly converted to int so the length is set to 0 that gave the undefined behavior 

