#include <bits/stdc++.h>   using namespace std;   const int MAX = 2e6 + 5;   char s1[MAX], s2[MAX];   int main() {     cin >> s1 + 1;     cin >> s2 + 1;     int len1 = strlen(s1 + 1);     int len2 = strlen(s2 + 1);     int i = 1, j = 1;     for (; i <= len1 && j <= len2;) {       if (s1[i] == s2[j])         i++, j++;       else         j++;     }     if (i != len1 + 1) {       puts( 0 );       return 0;     }     int tmp1 = j - 1;     for (i = len1, j = len2; j >= 1 && i >= 1;) {       if (s1[i] == s2[j])         i--, j--;       else         j--;     }     if (i != 0) {       puts( 0 );       return 0;     }     int tmp2 = j + 1;     if (tmp2 - tmp1 >= 0) {       printf( %d n , tmp2 - tmp1);     } else       printf( 0 );     return 0;   }   