2.
Yes it works because the string literals gives you a pointer (const char*) that can work as an iterator. The string still needs to be at least as long as the vector though.
The first example is unsafe (more precisely is invalid) because the size of the string is less than the size of the vector. The behavior of the example is undefined.
The second code is safe.
Take into account that in the first example you are trying to compare unsigned char with char (the value type of std::string) which can behave as signed char. So you can get the result other you hoped to get.
Yes it is ok. In this example it is unimportant that you can compare unsigned char with signed character because equivalence is used. But in other cases where for example operator < is used it is important.