#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool GetMatchLen(char* p, char* s, int len, vector<int>& valid) {
if(*p == '\0') {
if( len > 0 ) {
valid.push_back(len);
return true;
} else {
return false;
}
}
if(*s == '\0') {
return false;
}
if(*p == '*') {
auto ok = false;
if(GetMatchLen(p+1, s, len, valid)) {
ok = true;
}
if(GetMatchLen(p, s+1, len+1, valid)||GetMatchLen(p+1, s+1, len+1, valid)) {
ok = true;
}
return ok;
}
if(*p != *s) {
return false;
} else {
return GetMatchLen(p+1, s+1, len+1, valid);
}
}
int main() {
string p, s;
cin >> p >> s;
int n = 0;
for(auto i = 0; i < s.size(); i++) {
vector<int> valid;
GetMatchLen(p.data(), &s[i], 0, valid);
for(auto v : valid) {
cout << i << " " << v << endl;
}
n += valid.size();
}
if(n == 0) {
cout << "-1 0" <<endl;
}
}
// 64 位输出请用 printf("%lld")