I have substr working in a for loop, but its missing a matching letter;

Code:
#include <iostream>
#include <string>

using namespace std;

int main()
{
     string msg = "apple";
     string msg2 = "padlock";
     string string_block;

     for (int i = 0; i+1<msg.length(); ++i){
        string_block = msg.substr((msg[i] == msg2[i]) == 0) ;   // second argument of substr is length, not end.
        cout << "String Block: " << string_block[i] << endl;
     }

    return 0;
}
The output;

String Block: p
String Block: p
String Block: l
String Block: l

Process returned 0 (0x0) execution time : 0.000 s
Press any key to continue.

__________________

As you see, the letter 'a' is missing.


This one works;

Code:
#include <iostream>
#include <string>

using namespace std;

int main()
{
     string msg = "aapple";
     string msg2 = "padlock";
     string string_block;

     for (int i = 0; i+1<msg.length(); ++i){
        string_block = msg.substr((msg[i] == msg2[i]) == 0) ;   // second argument of substr is length, not end.
        cout << "String Block: " << string_block[i] << endl;
     }

    return 0;
}
The results;

String Block: a
String Block: a
String Block: p
String Block: l
String Block: e

Process returned 0 (0x0) execution time : 0.000 s
Press any key to continue.

________

But now there is an 'e'.