> if(It != string_find_iterator()) cout << "(" << i << ", " << j << ") : " << (*It) << endl;
 
Modify this line to (*It) ==> (*It++)
if(It != string_find_iterator()) cout << "(" << i << ", " << j << ") : " << (*It++) << endl;
 
And output would be
$ ./a.exe
(0, 0) : ab
(0, 1) : cd
(1, 0) :
(1, 1) :
(2, 0) : xy
(2, 1) : z
 
Thank you,
NitiN
( NITIN DOT MOTGI AT GMAIL DOT COM )