#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; int main(){ string S, T; cin >> S >> T; if(S.size() < T.size()){ cout << 0 << endl; return 0; } if(S.find(T) == string::npos){ cout << 0 << endl; return 0; } if(T.size() == 1){ cout << -1 << endl; return 0; } int ret = 0; string SS = ""; for(int i=S.size()-1; i>=0; i--){ SS = S[i] + SS; if(SS.size() < T.size()) continue; bool flg = true; rep(j,T.size()){ if(SS[j] != T[j]){ flg = false; break; } } if(flg){ SS[0] = '.'; SS = S[i] + SS; ret++; } cerr << SS << endl; } cout << ret << endl; return 0; }