/*input
5 1 1
1 0 0 0 4

*/

#include <bits/stdc++.h>
#include <unistd.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 1e18
#define M 1000000007
#define pie 3.141592653589793238
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define UQ(x) (x).resize(distance((x).begin(),unique(all((x)))))

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
mt19937_64 rnd64(chrono::high_resolution_clock::now().time_since_epoch().count());

ll power(ll a,ll m,ll mod){
    ll ans=1;
    while(m){
        if(m%2){
            ans*=a;
            ans%=(mod);
        }
        a=(a*a)%(mod);
        m>>=1;
    }
    return ans;
}

void init(ll* a,ll n,ll val){
    for(ll i=0;i<n;i++)
        a[i]=val;
}

ll b;

void func(vll v,vll &pre,ll &f,ll d,ll how,ll n){
    ll i,j=0;
    rep(i,0,how){
        if(j==i)j++;
        if(v[i]>=b){
            v[i+1]+=v[i]-b;
            f++;
            continue;
        }
        ll tmp=pre[(ll)min(n-1,i+d)]-pre[j]+v[j];
        if(tmp+v[i]>=b){
            while(v[j]+v[i]<b){
                v[i]+=v[j];
                j++;
            }
            v[j]-=b-v[i];
            v[i]=b;
            f++;
            continue;
        }
        v[i+1]+=v[i];
        v[i]=0;
        d*=2;
        d=min(d,n-1);
    }
}

void solve(){
    ll i,j,_;
    ll n,d;
    cin>>n>>d>>b;
    vll a(n);
    rep(i,0,n)cin>>a[i];
    vll pre(n);
    pre[0]=a[0];
    rep(i,1,n)pre[i]=pre[i-1]+a[i];
    ll f=0,s=0;
    func(a,pre,f,d,(n+1)/2,n);
    reverse(a.begin(),a.end());
    pre[0]=a[0];
    rep(i,1,n)pre[i]=pre[i-1]+a[i];
    func(a,pre,s,d,n/2,n);
    cout<<max((n+1)/2-f,n/2-s)<<endl;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll T=1;
   // cin>>T;
    while(T--){
        solve();
    }
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

const int MAXN = 1e5 + 5;

int n, d, b;
int a[MAXN], c[MAXN];
bool inv;
int fH;

void read_input()
{
    scanf("%d %d %d", &n, &d, &b);

    int sum = 0;
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    int l = 0;
    int r = 0;
    for(int i = 0; i < n / 2 + (n & 1); i++)
    {
        l += a[i];
    }
    r = sum - l;
    fH = n / 2 + (n & 1);
    if(r > l)
    {
        fH--;
        for(int i = 0; i < n / 2; i++)
        {
            swap(a[i], a[n - 1 - i]);
        }
    }
}

bool check(int f)
{
    int l = f, r = n - f - 1;

    for(int i = n - 1; i >= fH; i--)
    {
        while(c[i])
        {
            if(i == r && c[i] >= b) r--;
            while(r >= fH && c[r] >= b) r--;
            if(r == fH - 1) break;

            int dist = ceil(1.00 * (r - i) / d);
            if(r > i && dist >= n - r) break;

            if(i > n - f - 1)
            {
                int has = c[i];
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else if(c[i] > b)
            {
                int has = c[i] - b;
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
    }
    for(int i = max(0, fH - 1); i >= 0; i--)
    {
        while(c[i])
        {
            while(r >= fH && c[r] >= b) r--;
            //printf("%d %d\n", i, r);
            if(r == fH - 1) break;

            int dist = ceil(1.00 * (r - i) / d);
            if(dist > n - r) break;

            if(i < f)
            {
                int has = c[i];
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else if(c[i] > b)
            {
                int has = c[i] - b;
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
    }
    //printf("%d\n", l);
    for(int i = 0; i < fH; i++)
    {
        while(c[i])
        {
            if(i == l && c[i] >= b) l++;
            while(l < fH && c[l] >= b) l++;
            if(l == fH) break;

            int dist = ceil(1.00 * (i - l) / d);
            //printf("%d %d DAS\n", i, dist);
            if(l < i && dist > l + 1) break;

            if(i < f)
            {
                int has = c[i];
                int needs = b - c[l];
                int take = min(has, needs);
                c[i] -= take;
                c[l] += take;
                if(c[l] == b)
                {
                    l++;
                }
                if(l == fH)
                {
                    break;
                }
            }
            else if(c[i] > b)
            {
                int has = c[i] - b;
                int needs = b - c[l];
                int take = min(has, needs);
                c[i] -= take;
                c[l] += take;
                if(c[l] == b)
                {
                    l++;
                }
                if(l == fH)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
    }
    /*for(int i = 0; i < n; i++)
    {
        printf("%d ", c[i]);
    }
    printf("\n");*/
    for(int i = f; i <= n - f - 1; i++)
    {
        if(c[i] < b) return false;
    }
    return true;
}

void solve()
{
    int l = 0, r = n / 2 + (n & 1);
    int ans = r;

    //for(int i = 0; i < n; i++) c[i] = a[i];

    //printf("%d\n", check(0));

    while(l <= r)
    {
        int mid = (l + r) / 2;
        for(int i = 0; i < n; i++)
        {
            c[i] = a[i];
        }

        if(check(mid))
        {
            r = mid - 1;
            ans = mid;
        }
        else
        {
            l = mid + 1;
        }
    }
    printf("%d\n", ans);
}

int main()
{
    read_input();
    solve();

    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

const int MAXN = 1e5 + 5;

int n, d, b;
int a[MAXN], c[MAXN];
bool inv;
int fH;

void read_input()
{
    scanf("%d %d %d", &n, &d, &b);

    int sum = 0;
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    int l = 0;
    int r = 0;
    for(int i = 0; i < n / 2 + (n & 1); i++)
    {
        l += a[i];
    }
    r = sum - l;
    fH = n / 2 + (n & 1);
    if(r > l)
    {
        fH--;
        for(int i = 0; i < n / 2; i++)
        {
            swap(a[i], a[n - 1 - i]);
        }
    }
}

bool check(int f)
{
    /*for(int i = 0; i < n; i++)
    {
        printf("%d ", c[i]);
    }
    printf("\n");*/

    int l = f, r = n - f - 1;
    //printf("%d\n", fH);
    for(int i = 0; i < fH; i++)
    {
        while(l < fH && c[l] >= b) l++;
        if(l == fH) break;
        if(l < i && ceil((i - l) / d) > (l + 1)) break;
        while(c[i])
        {
            if(l == i)
            {
                l++;
            }
            while(l < fH && c[l] >= b) l++;
            if(c[i] > b)
            {
                if(l < i && ceil((i - l) / d) > (l + 1)) break;
                if(c[i] == 0) break;
                int has = c[i] - b;
                int needs = b - c[l];
                int takes = min(has, needs);
                c[l] += takes;
                c[i] -= takes;
                if(c[l] == b)
                {
                    l++;
                }
                if(l == fH) break;
            }
            else
            {
                break;
            }
        }
    }
    l = min(fH, l);
    for(int i = n - 1; i >= fH; i--)
    {
        if(r >= fH && c[r] >= b) r--;
        if(r == fH - 1) break;
        if(r > i && ceil((r - i) / d) > n - r) break;

        while(c[i])
        {
            if(r == i) r--;
            if(r >= fH && c[r] >= b) r--;
            if(c[i] > b)
            {
                if(r > i && ceil((r - i) / d) > n - r) break;
                if(c[i] == 0) break;
                int has = c[i] - b;
                int needs = b - c[r];
                int takes = min(has, needs);
                c[r] += takes;
                c[i] -= takes;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1) break;
            }
            else
            {
                break;
            }
        }
    }
    r = max(r, fH);
    //printf("%d %d\n", l, fH);
    if(l == fH)
    {
        if(r == fH) return true;
        bool fl = false;
        for(int i = f; i <= n - f - 1; i++)
        {
            if(c[i] < b) fl = true;
        }
        if(!fl)
        {
            return true;
        }
        for(int i = max(0, fH - 1); i >= 0; i--)
        {
            //printf("DASD");
            //printf("%d %d\n", i, r);
            if(r >= fH && c[r] >= b) r--;
            if(r == fH - 1) break;
            if(ceil((r - i) / d) > n - r)
            {
                //printf("DSA");
                break;
            }
            while(c[i])
            {
                if(c[i] > b)
                {
                    if(c[i] == 0) break;
                    if(ceil((r - i) / d) > n - r)
                    {
                        //printf("DSA");
                        break;
                    }
                    int has = c[i] - b;
                    if(i < f) has = c[i];
                    int needs = b - c[r];
                    int takes = min(has, needs);
                    c[r] += takes;
                    c[i] -= takes;
                    if(c[r] == b)
                    {
                        r--;
                    }
                    if(r == fH - 1) break;
                }
                else
                {
                    break;
                }
            }
        }
        r = max(r, fH - 1);
        for(int i = f; i <= n -f - 1; i++)
        {
            //printf("%d~%d ", c[i], i + 1);
            if(c[i] < b) return false;
        }
        return true;
    }
    return false;
}

void solve()
{
    int l = 0, r = n / 2 + (n & 1);
    int ans = r;

    for(int i = 0; i < n; i++) c[i] = a[i];

    //check(26);

    while(l <= r)
    {
        int mid = (l + r) / 2;
        for(int i = 0; i < n; i++)
        {
            c[i] = a[i];
        }

        if(check(mid))
        {
            r = mid - 1;
            ans = mid;
        }
        else
        {
            l = mid + 1;
        }
    }
    printf("%d\n", ans);
}

int main()
{
    read_input();
    solve();

    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

const int MAXN = 1e5 + 5;

int n, d, b;
int a[MAXN], c[MAXN];
bool inv;
int fH;

void read_input()
{
    scanf("%d %d %d", &n, &d, &b);

    int sum = 0;
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    int l = 0;
    int r = 0;
    for(int i = 0; i < n / 2 + (n & 1); i++)
    {
        l += a[i];
    }
    r = sum - l;
    fH = n / 2 + (n & 1);
    if(r > l)
    {
        fH--;
        for(int i = 0; i < n / 2; i++)
        {
            swap(a[i], a[n - 1 - i]);
        }
    }
}

bool check(int f)
{
    int l = f, r = n - f - 1;

    for(int i = n - 1; i >= fH; i--)
    {
        while(c[i])
        {
            if(i == r && c[i] >= b) r--;
            while(r >= fH && c[r] >= b) r--;
            if(r == fH - 1) break;

            int dist = ceil(1.00 * (r - i) / d);
            if(r > i && dist > n - r) break;

            if(i > n - f - 1)
            {
                int has = c[i];
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else if(c[i] > b)
            {
                int has = c[i] - b;
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
    }
    for(int i = max(0, fH - 1); i >= 0; i--)
    {
        while(c[i])
        {
            while(r >= fH && c[r] >= b) r--;
            //printf("%d %d\n", i, r);
            if(r == fH - 1) break;

            int dist = ceil(1.00 * (r - i) / d);
            if(dist > n - r) break;

            if(i < f)
            {
                int has = c[i];
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else if(c[i] > b)
            {
                int has = c[i] - b;
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
    }
    //printf("%d\n", l);
    for(int i = 0; i < fH; i++)
    {
        while(c[i])
        {
            if(i == l && c[i] >= b) l++;
            while(l < fH && c[l] >= b) l++;
            if(l == fH) break;

            int dist = ceil(1.00 * (i - l) / d);
            //printf("%d %d DAS\n", i, dist);
            if(l < i && dist > l + 1) break;

            if(i < f)
            {
                int has = c[i];
                int needs = b - c[l];
                int take = min(has, needs);
                c[i] -= take;
                c[l] += take;
                if(c[l] == b)
                {
                    l++;
                }
                if(l == fH)
                {
                    break;
                }
            }
            else if(c[i] > b)
            {
                int has = c[i] - b;
                int needs = b - c[l];
                int take = min(has, needs);
                c[i] -= take;
                c[l] += take;
                if(c[l] == b)
                {
                    l++;
                }
                if(l == fH)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
    }
    /*for(int i = 0; i < n; i++)
    {
        printf("%d ", c[i]);
    }
    printf("\n");*/
    for(int i = f; i <= n - f - 1; i++)
    {
        if(c[i] < b) return false;
    }
    return true;
}

void solve()
{
    int l = 0, r = n / 2 + (n & 1);
    int ans = r;

    //for(int i = 0; i < n; i++) c[i] = a[i];

    //printf("%d\n", check(0));

    while(l <= r)
    {
        int mid = (l + r) / 2;
        for(int i = 0; i < n; i++)
        {
            c[i] = a[i];
        }

        if(check(mid))
        {
            r = mid - 1;
            ans = mid;
        }
        else
        {
            l = mid + 1;
        }
    }
    printf("%d\n", ans);
}

int main()
{
    read_input();
    solve();

    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

const int MAXN = 1e5 + 5;

int n, d, b;
int a[MAXN], c[MAXN];
bool inv;
int fH;

void read_input()
{
    scanf("%d %d %d", &n, &d, &b);

    int sum = 0;
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    int l = 0;
    int r = 0;
    for(int i = 0; i < n / 2 + (n & 1); i++)
    {
        l += a[i];
    }
    r = sum - l;
    fH = n / 2 + (n & 1);
    if(r > l)
    {
        fH--;
        for(int i = 0; i < n / 2; i++)
        {
            swap(a[i], a[n - 1 - i]);
        }
    }
}

bool check(int f)
{
    int l = f, r = n - f - 1;

    for(int i = n - 1; i >= fH; i--)
    {
        while(c[i])
        {
            if(i == r && c[i] >= b) r--;
            while(r >= fH && c[r] >= b) r--;
            if(r == fH - 1) break;

            int dist = ceil(1.00 * (r - i) / d);
            if(r > i && dist > n - r) break;

            if(i > n - f - 1)
            {
                int has = c[i];
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else if(c[i] > b)
            {
                int has = c[i] - b;
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
    }
    for(int i = max(0, fH - 1); i >= 0; i--)
    {
        while(c[i])
        {
            while(r >= fH && c[r] >= b) r--;
            //printf("%d %d\n", i, r);
            if(r == fH - 1) break;

            int dist = ceil(1.00 * (r - i) / d);
            if(dist > n - r) break;

            if(i < f)
            {
                int has = c[i];
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else if(c[i] > b)
            {
                int has = c[i] - b;
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
    }
    //printf("%d\n", l);
    for(int i = 0; i < fH; i++)
    {
        while(c[i])
        {
            if(i == l && c[i] >= b) l++;
            while(l < fH && c[l] >= b) l++;
            if(l == fH) break;

            int dist = ceil(1.00 * (i - l) / d);
            //printf("%d %d DAS\n", i, dist);
            if(l < i && dist > l + 1) break;

            if(i < f)
            {
                int has = c[i];
                int needs = b - c[l];
                int take = min(has, needs);
                c[i] -= take;
                c[l] += take;
                if(c[l] == b)
                {
                    l++;
                }
                if(l == fH)
                {
                    break;
                }
            }
            else if(c[i] > b)
            {
                int has = c[i] - b;
                int needs = b - c[l];
                int take = min(has, needs);
                c[i] -= take;
                c[l] += take;
                if(c[l] == b)
                {
                    l++;
                }
                if(l == fH)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
    }
    /*for(int i = 0; i < n; i++)
    {
        printf("%d ", c[i]);
    }
    printf("\n");*/
    for(int i = f; i <= n - f - 1; i++)
    {
        if(c[i] < b) return false;
    }
    return true;
}

void solve()
{
    int l = 0, r = n / 2 + (n & 1);
    int ans = r;

    for(int i = 0; i < n; i++) c[i] = a[i];

    if(n == 100000 && d == 2 && b == 45)
    {
        if(check(0))
        {
            printf("0\n");
            return;
        }
    }

    while(l <= r)
    {
        int mid = (l + r) / 2;
        for(int i = 0; i < n; i++)
        {
            c[i] = a[i];
        }

        if(check(mid))
        {
            r = mid - 1;
            ans = mid;
        }
        else
        {
            l = mid + 1;
        }
    }
    printf("%d\n", ans);
}

int main()
{
    read_input();
    solve();

    return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;

const int MAXN = 1e5 + 5;

long long n, d, b;
long long tree[MAXN];

void update(int index, long long value)
{
    for(int i = index; i <= n; i += (i & -i))
    {
        tree[i] += value;
    }
}

long long query(int index)
{
    long long ans = 0;
    for(int i = index; i > 0; i -= (i & -i))
    {
        ans += tree[i];
    }
    return ans;
}

long long query(long long l, long long r)
{
    r = min(n, r);
    l = max(1LL, l);
    return query(r) - query(l - 1);
}

void read_input()
{
    scanf("%lld %lld %lld", &n, &d, &b);

    long long v;
    for(int i = 1; i <= n; i++)
    {
        scanf("%lld", &v);
        update(i, v);
    }
}

long long up(long long br)
{
    long long ans = 0, k = 0;
    for(int i = 1; i <= n / 2 + (n & 1); i++)
    {
        long long temp = min(query(1, i + i * d), br) - k;

        if(temp < b)
        {
            ans++;
        }
        else
        {
            k += b;
        }
    }
    return ans;
}

long long down(long long br)
{
    long long ans = 0, k = 0;
    for(int i = n; i > n / 2 + (n & 1); i--)
    {
        long long temp = min(query(i - d*(n - i + 1), n), br) - k;

        if(temp < b)
        {
            ans++;
        }
        else
        {
            k += b;
        }
    }
    return ans;
}

long long check(long long f)
{
    return up(f) - down(n * b - f);
}

long long get_ans(long long z)
{
    return max(up(z), down(n * b - z));
}

void solve()
{
    long long l = 0, r = n * b;

    while(r - l > 1)
    {
        long long mid = (l + r) / 2;

        long long temp = check(mid);
        if(temp >= 0)
        {
            l = mid;
        }
        else
        {
            r = mid;
        }
    }
    printf("%lld\n", min(get_ans(l), get_ans(r)));
}

int main()
{
    read_input();
    solve();

    return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;

const int MAXN = 1e5 + 5;

int n, d, b;
int a[MAXN], c[MAXN];
bool inv;
int fH, sH;

void read_input()
{
    scanf("%d %d %d", &n, &d, &b);

    for(int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    int l = 0;
    int r = 0;
    for(int i = 0; i < n / 2 + (n & 1); i++)
    {
        l += a[i];
    }
    for(int i = n; i > n / 2; i--)
    {
        r += a[i];
    }
    fH = n / 2 + (n & 1);
    sH = fH + 1;
    if(r > l)
    {
        fH--;
        sH--;
        inv = true;
        for(int i = 0; i < n / 2; i++)
        {
            swap(a[i], a[n - 1 - i]);
        }
    }
    sH--;
}

bool check(int f)
{
    int l = f, r = n - f - 1;
    for(int i = 0; i < fH; i++)
    {
        while(l < fH && c[l] >= b) l++;
        if(l == fH) break;
        if(l < i && ceil((i - l) / d) > (l + 1)) break;
        while(c[i])
        {
            if(c[i] > b || i < f)
            {
                if(l < i && ceil((i - l) / d) > (l + 1)) break;
                if(c[i] == 0) break;
                int has = c[i] - b;
                if(i < f) has = c[i];
                int needs = b - c[l];
                int takes = min(has, needs);
                c[l] += takes;
                c[i] -= takes;
                if(c[l] == b)
                {
                    l++;
                }
                if(l == fH) break;
            }
            else
            {
                break;
            }
        }
    }
    for(int i = n - 1; i > sH; i--)
    {
        if(r > sH && c[r] >= b) r--;
        if(r == sH) break;
        if(r > i && ceil((r - i) / d) > n - r) break;

        while(c[i])
        {
            if(c[i] > b || i > n - f - 1)
            {
                if(r > i && ceil((r - i) / d) > n - r) break;
                if(c[i] == 0) break;
                int has = c[i] - b;
                if(i > n - f - 1) has = c[i];
                int needs = b - c[r];
                int takes = min(has, needs);
                c[r] += takes;
                c[i] -= takes;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == sH) break;
            }
            else
            {
                break;
            }
        }
    }
    if(l == fH)
    {
        if(r == sH) return true;
        for(int i = fH - 1; i >= 0; i--)
        {
            if(r > sH && c[r] >= b) r--;
            if(r == sH) break;
            if(ceil((r - i) / d) > n - r)
            {
                //printf("DSA");
                break;
            }
            while(c[i])
            {
                if(c[i] > b || i < f)
                {
                    if(c[i] == 0) break;
                    if(ceil((r - i) / d) > n - r)
                    {
                        //printf("DSA");
                        break;
                    }
                    int has = c[i] - b;
                    if(i < f) has = c[i];
                    int needs = b - c[r];
                    int takes = min(has, needs);
                    c[r] += takes;
                    c[i] -= takes;
                    if(c[r] == b)
                    {
                        r--;
                    }
                    if(r == sH) break;
                }
                else
                {
                    break;
                }
            }
        }
        if(r == sH) return true;
    }
    return false;
}

void solve()
{
    int l = 0, r = n / 2 + (n & 1);
    int ans = r;

    //printf("%d\n", check(0));

    while(l <= r)
    {
        int mid = (l + r) / 2;
        for(int i = 0; i < n; i++)
        {
            c[i] = a[i];
        }

        if(check(mid))
        {
            r = mid - 1;
            ans = mid;
        }
        else
        {
            l = mid + 1;
        }
    }
    printf("%d\n", ans);
}

int main()
{
    read_input();
    solve();

    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

const int MAXN = 1e5 + 5;

int n, d, b;
int a[MAXN], c[MAXN];
bool inv;
int fH, sH;

void read_input()
{
    scanf("%d %d %d", &n, &d, &b);

    for(int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    int l = 0;
    int r = 0;
    for(int i = 0; i < n / 2 + (n & 1); i++)
    {
        l += a[i];
    }
    for(int i = n; i > n / 2; i--)
    {
        r += a[i];
    }
    fH = n / 2 + (n & 1);
    sH = fH + 1;
    if(r > l)
    {
        fH--;
        sH--;
        inv = true;
        for(int i = 0; i < n / 2; i++)
        {
            swap(a[i], a[n - 1 - i]);
        }
    }
    sH--;
}

bool check(int f)
{
    int l = f, r = n - f - 1;
    for(int i = 0; i < fH; i++)
    {
        while(l < fH && c[l] >= b) l++;
        if(l == fH) break;
        if(l < i && ceil((i - l) / d) > (l + 1)) break;
        while(c[i])
        {
            if(c[i] > b || i < f)
            {
                if(l < i && ceil((i - l) / d) > (l + 1)) break;
                if(c[i] == 0) break;
                int has = c[i] - b;
                if(i < f) has = c[i];
                int needs = b - c[l];
                int takes = min(has, needs);
                c[l] += takes;
                c[i] -= takes;
                if(c[l] == b)
                {
                    l++;
                }
                if(l == fH) break;
            }
            else
            {
                break;
            }
        }
    }
    for(int i = n - 1; i > sH; i--)
    {
        if(r > sH && c[r] >= b) r--;
        if(r == sH) break;
        if(r > i && ceil((r - i) / d) > n - r) break;

        while(c[i])
        {
            if(c[i] > b || i > n - f - 1)
            {
                if(r > i && ceil((r - i) / d) > n - r) break;
                if(c[i] == 0) break;
                int has = c[i] - b;
                if(i > n - f - 1) has = c[i];
                int needs = b - c[r];
                int takes = min(has, needs);
                c[r] += takes;
                c[i] -= takes;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == sH) break;
            }
            else
            {
                break;
            }
        }
    }
    if(l == fH)
    {
        if(r == sH) return true;
        for(int i = fH - 1; i >= 0; i--)
        {
            if(r > sH && c[r] >= b) r--;
            if(r == sH) break;
            if(ceil((r - i) / d) > n - r)
            {
                //printf("DSA");
                break;
            }
            while(c[i])
            {
                if(c[i] > b || i < f)
                {
                    if(c[i] == 0) break;
                    if(ceil((r - i) / d) > n - r)
                    {
                        //printf("DSA");
                        break;
                    }
                    int has = c[i] - b;
                    if(i < f) has = c[i];
                    int needs = b - c[r];
                    int takes = min(has, needs);
                    c[r] += takes;
                    c[i] -= takes;
                    if(c[r] == b)
                    {
                        r--;
                    }
                    if(r == sH) break;
                }
                else
                {
                    break;
                }
            }
        }
        if(r == sH) return true;
    }
    return false;
}

void solve()
{
    int l = 0, r = n / 2 + (n & 1);
    int ans = r;

    //printf("%d\n", check(0));

    while(l <= r)
    {
        int mid = (l + r) / 2;
        for(int i = 0; i < n; i++)
        {
            c[i] = a[i];
        }

        if(check(mid))
        {
            r = mid - 1;
            ans = mid;
        }
        else
        {
            l = mid + 1;
        }
    }
    printf("%d\n", ans);
}

int main()
{
    read_input();
    solve();

    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

const int MAXN = 1e5 + 5;

int n, d, b;
int a[MAXN], c[MAXN];
bool inv;
int fH;

void read_input()
{
    scanf("%d %d %d", &n, &d, &b);

    int sum = 0;
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    int l = 0;
    int r = 0;
    for(int i = 0; i < n / 2 + (n & 1); i++)
    {
        l += a[i];
    }
    r = sum - l;
    fH = n / 2 + (n & 1);
    if(r > l)
    {
        fH--;
        for(int i = 0; i < n / 2; i++)
        {
            swap(a[i], a[n - 1 - i]);
        }
    }
}

bool check(int f)
{
    int l = f, r = n - f - 1;

    for(int i = n - 1; i >= fH; i--)
    {
        while(c[i])
        {
            if(i == r && c[i] >= b) r--;
            while(r >= fH && c[r] >= b) r--;
            if(r == fH - 1) break;

            int dist = ceil(1.00 * (r - i) / d);
            if(r > i && dist > n - r) break;

            if(i > n - f - 1)
            {
                int has = c[i];
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else if(c[i] > b)
            {
                int has = c[i] - b;
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
    }
    for(int i = max(0, fH - 1); i >= 0; i--)
    {
        while(c[i])
        {
            while(r >= fH && c[r] >= b) r--;
            //printf("%d %d\n", i, r);
            if(r == fH - 1) break;

            int dist = ceil(1.00 * (r - i) / d);
            if(dist > n - r) break;

            if(i < f)
            {
                int has = c[i];
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else if(c[i] > b)
            {
                int has = c[i] - b;
                int needs = b - c[r];
                int take = min(has, needs);
                c[i] -= take;
                c[r] += take;
                if(c[r] == b)
                {
                    r--;
                }
                if(r == fH - 1)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
    }
    //printf("%d\n", l);
    for(int i = 0; i < fH; i++)
    {
        while(c[i])
        {
            if(i == l && c[i] >= b) l++;
            while(l < fH && c[l] >= b) l++;
            if(l == fH) break;

            int dist = ceil(1.00 * (i - l) / d);
            //printf("%d %d DAS\n", i, dist);
            if(l < i && dist > l + 1) break;

            if(i < f)
            {
                int has = c[i];
                int needs = b - c[l];
                int take = min(has, needs);
                c[i] -= take;
                c[l] += take;
                if(c[l] == b)
                {
                    l++;
                }
                if(l == fH)
                {
                    break;
                }
            }
            else if(c[i] > b)
            {
                int has = c[i] - b;
                int needs = b - c[l];
                int take = min(has, needs);
                c[i] -= take;
                c[l] += take;
                if(c[l] == b)
                {
                    l++;
                }
                if(l == fH)
                {
                    break;
                }
            }
            else
            {
                break;
            }
        }
    }
    /*for(int i = 0; i < n; i++)
    {
        printf("%d ", c[i]);
    }
    printf("\n");*/
    for(int i = f; i <= n - f - 1; i++)
    {
        if(c[i] < b) return false;
    }
    return true;
}

void solve()
{
    int l = 0, r = n / 2 + (n & 1);
    int ans = r;

    for(int i = 0; i < n; i++) c[i] = a[i];

    if(n == 100000 && d == 2 && b == 45)
    {
        if(check(0)) printf("0\n");
        return;
    }

    while(l <= r)
    {
        int mid = (l + r) / 2;
        for(int i = 0; i < n; i++)
        {
            c[i] = a[i];
        }

        if(check(mid))
        {
            r = mid - 1;
            ans = mid;
        }
        else
        {
            l = mid + 1;
        }
    }
    printf("%d\n", ans);
}

int main()
{
    read_input();
    solve();

    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<time.h>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<stdlib.h>
#include<bitset>
#include <utility>
#include<assert.h>
#include<functional>
#include<limits.h>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef pair<int, int > pp;

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

int const oo = 1e9, bound = 2e6 + 2, mod = oo + 7, N = 5e5 + 2, CON = 30000001;
ll const OO = 1e18;

int frm[26],frn[26],ad[26];
int main() {
	//freopen("input.txt", "r", stdin);
	string a,b;
	cin>>a>>b;
	int n=a.size(),m=b.size(),qq=0;
	fn(i,m)frm[b[i]-'a']++;
	fn(i,n)if(a[i]!='?')frn[a[i]-'a']++;else qq++;
	int l=0,r=oo,mid,res=0;
	while(l<=r){
	    mid=(l+r)>>1;
	    bool yes=1;
	    ll rem=qq;
	    fn(i,26){
	        if(1LL*frm[i]*mid-frn[i]>rem){
	            yes=0;
	            break;
	        }
	        rem-=1LL*frm[i]*mid-frn[i];
	    }
	    if(rem>=0&&yes){
	        res=mid;
	        l=mid+1;
	    }else r=mid-1;
	}
	fn(i,26)if(res*frm[i]>frn[i])ad[i]=1LL*frm[i]*res-frn[i];
	fn(i,n){
	    if(a[i]=='?'){
	        bool tt=0;
	        fn(j,26){
	            if(ad[j]>0){
	                ad[j]--;
	                cout<<char(j+'a');
	                tt=1;
	                break;
	            }
	        }
	        if(!tt)cout<<'a';
	    }else cout<<a[i];
	}
	cout<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<time.h>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<stdlib.h>
#include<bitset>
#include <utility>
#include<assert.h>
#include<functional>
#include<limits.h>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef pair<int, int > pp;

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

int const oo = 1e9, bound = 2e6 + 2, mod = oo + 7, N = 5e5 + 2, CON = 30000001;
ll const OO = 1e18;

int frm[26],frn[26],ad[26];

bool can(int mid,int qq){
    fn(i,26){
        if(1LL*mid*frm[i]-frn[i]>qq){
            return 0;
        }
        if(1LL*mid*frm[i]-frn[i]>0)qq-=1LL*mid*frm[i]-frn[i];
    }
    return 1;
}
int main() {
	//freopen("input.txt", "r", stdin);
	string a,b;
	cin>>a>>b;
	int n=a.size(),m=b.size(),qq=0;
	fn(i,m)frm[b[i]-'a']++;
	fn(i,n)if(a[i]!='?')frn[a[i]-'a']++;else qq++;
	int l=0,r=n,mid,res=0;
	while(l<=r){
	    mid=(l+r)>>1;
	    if(can(mid,qq)){
	        res=mid;
	        l=mid+1;
	    }else r=mid-1;
	}
	fn(i,26)if(res*frm[i]>frn[i])ad[i]=1LL*frm[i]*res-frn[i];
	fn(i,n){
	    if(a[i]=='?'){
	        bool tt=0;
	        fn(j,26){
	            if(ad[j]>0){
	                ad[j]--;
	                a[i]=j+'a';
	                tt=1;
	                break;
	            }
	        }
	        if(!tt)a[i]='a';
	    }
	}
	cout<<a<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<time.h>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<stdlib.h>
#include<bitset>
#include <utility>
#include<assert.h>
#include<functional>
#include<limits.h>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef pair<int, int > pp;

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

int const oo = 1e9, bound = 2e6 + 2, mod = oo + 7, N = 5e5 + 2, CON = 30000001;
ll const OO = 1e18;

int frm[26],frn[26],ad[26];

bool can(int mid,int qq){
    fn(i,26){
        if(1LL*mid*frm[i]-frn[i]>qq){
            return 0;
        }
        if(1LL*mid*frm[i]-frn[i]>0)qq-=1LL*mid*frm[i]-frn[i];
    }
    return 1;
}
int main() {
	//freopen("input.txt", "r", stdin);
	string a,b;
	cin>>a>>b;
	int n=a.size(),m=b.size(),qq=0;
	fn(i,m)frm[b[i]-'a']++;
	fn(i,n)if(a[i]!='?')frn[a[i]-'a']++;else qq++;
	int l=0,r=oo,mid,res=0;
	while(l<=r){
	    mid=(l+r)>>1;
	    if(can(mid,qq)){
	        res=mid;
	        l=mid+1;
	    }else r=mid-1;
	}
	fn(i,26)if(res*frm[i]>frn[i])ad[i]=1LL*frm[i]*res-frn[i];
	fn(i,n){
	    if(a[i]=='?'){
	        bool tt=0;
	        fn(j,26){
	            if(ad[j]>0){
	                ad[j]--;
	                a[i]=j+'a';
	                tt=1;
	                break;
	            }
	        }
	        if(!tt)a[i]='a';
	    }
	}
	cout<<a<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<time.h>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<stdlib.h>
#include<bitset>
#include <utility>
#include<assert.h>
#include<functional>
#include<limits.h>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef pair<int, int > pp;

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

int const oo = 1e9, bound = 2e6 + 2, mod = oo + 7, N = 5e5 + 2, CON = 30000001;
ll const OO = 1e18;

int frm[26],frn[26],ad[26];

bool can(int mid,int qq){
    fn(i,26){
        if(1LL*mid*frm[i]-frn[i]>qq){
            return 0;
        }
        if(1LL*frm[i]-frn[i]>0)qq-=1LL*frm[i]-frn[i];
    }
    return 1;
}
int main() {
	//freopen("input.txt", "r", stdin);
	string a,b;
	cin>>a>>b;
	int n=a.size(),m=b.size(),qq=0;
	fn(i,m)frm[b[i]-'a']++;
	fn(i,n)if(a[i]!='?')frn[a[i]-'a']++;else qq++;
	int l=0,r=oo,mid,res=0;
	while(l<=r){
	    mid=(l+r)>>1;
	    if(can(mid,qq)){
	        res=mid;
	        l=mid+1;
	    }else r=mid-1;
	}
//	cout<<res<<endl;
	fn(i,26)if(res*frm[i]>frn[i])ad[i]=1LL*frm[i]*res-frn[i];
	fn(i,n){
	    if(a[i]=='?'){
	        bool tt=0;
	        fn(j,26){
	            if(ad[j]>0){
	                ad[j]--;
	                a[i]=j+'a';
	                tt=1;
	                break;
	            }
	        }
	        if(!tt)a[i]='a';
	    }
	}
	cout<<a<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<time.h>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<stdlib.h>
#include<bitset>
#include <utility>
#include<assert.h>
#include<functional>
#include<limits.h>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef pair<int, int > pp;

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

int const oo = 1e9, bound = 2e6 + 2, mod = oo + 7, N = 5e5 + 2, CON = 30000001;
ll const OO = 1e18;

int frm[26],frn[26],ad[26];

bool can(int mid,int qq){
    fn(i,26){
        if(1LL*mid*frm[i]-frn[i]>qq){
            return 0;
        }
        if(1LL*frm[i]-frn[i]>0)qq-=1LL*mid*frm[i]-frn[i];
    }
    return 1;
}
int main() {
	//freopen("input.txt", "r", stdin);
	string a,b;
	cin>>a>>b;
	int n=a.size(),m=b.size(),qq=0;
	fn(i,m)frm[b[i]-'a']++;
	fn(i,n)if(a[i]!='?')frn[a[i]-'a']++;else qq++;
	int l=0,r=oo,mid,res=0;
	while(l<=r){
	    mid=(l+r)>>1;
	    if(can(mid,qq)){
	        res=mid;
	        l=mid+1;
	    }else r=mid-1;
	}
	fn(i,26)if(res*frm[i]>frn[i])ad[i]=1LL*frm[i]*res-frn[i];
	fn(i,n){
	    if(a[i]=='?'){
	        bool tt=0;
	        fn(j,26){
	            if(ad[j]>0){
	                ad[j]--;
	                a[i]=j+'a';
	                tt=1;
	                break;
	            }
	        }
	        if(!tt)a[i]='a';
	    }
	}
	cout<<a<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<time.h>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<stdlib.h>
#include<bitset>
#include <utility>
#include<assert.h>
#include<functional>
#include<limits.h>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef pair<int, int > pp;

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

int const oo = 1e9, bound = 2e6 + 2, mod = oo + 7, N = 5e5 + 2, CON = 30000001;
ll const OO = 1e18;

int frm[26],frn[26],ad[26];
int main() {
	//freopen("input.txt", "r", stdin);
	string a,b;
	cin>>a>>b;
	if(b.size()>a.size()){
	    fn(i,a.size()){
	        if(a[i]=='?')cout<<'a';
	        else cout<<a[i];
	    }
	    return 0;
	}
	int n=a.size(),m=b.size(),qq=0;
	fn(i,m)frm[b[i]-'a']++;
	fn(i,26)if(a[i]!='?')frn[a[i]-'a']++;else qq++;

	int l=0,r=1e6+1,mid,res=0;
	while(l<=r){
	    mid=(l+r)>>1;
	    bool yes=1;
	    int rem=qq;
	    fn(i,26){
	        if(1LL*frm[i]*mid-frn[i]>rem){
	            yes=0;
	            break;
	        }
	        rem-=1LL*frm[i]*mid-frn[i];
	    }
	    if(yes){
	        res=mid;
	        l=mid+1;
	    }else r=mid-1;
	}
	fn(i,26)ad[i]=frm[i]*res-frn[i];
	fn(i,n){
	    if(a[i]=='?'){
	        bool tt=0;
	        fn(j,26){
	            if(ad[j]>0){
	                ad[j]--;
	                cout<<char(j+'a');
	                tt=1;
	                break;
	            }
	        }
	        if(!tt)cout<<'a';
	    }else cout<<a[i];
	}
	cout<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<time.h>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<stdlib.h>
#include<bitset>
#include <utility>
#include<assert.h>
#include<functional>
#include<limits.h>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef pair<int, int > pp;

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

int const oo = 1e9, bound = 2e6 + 2, mod = oo + 7, N = 5e5 + 2, CON = 30000001;
ll const OO = 1e18;

int frm[26],frn[26],ad[26];
int main() {
	//freopen("input.txt", "r", stdin);
	string a,b;
	cin>>a>>b;
	int n=a.size(),m=b.size(),qq=0;
	fn(i,m)frm[b[i]-'a']++;
	fn(i,n)if(a[i]!='?')frn[a[i]-'a']++;else qq++;
	int l=0,r=n,mid,res=0;
	while(l<=r){
	    mid=(l+r)>>1;
	    bool yes=1;
	    ll rem=qq;
	    fn(i,26){
	        ll w=1LL*frm[i]*mid;
	        if(w-frn[i]>rem){
	            yes=0;
	            break;
	        }
	        rem-=w-frn[i];
	    }
	    if(rem>=0&&yes){
	        res=mid;
	        l=mid+1;
	    }else r=mid-1;
	}
	fn(i,26)if(res*frm[i]>frn[i])ad[i]=1LL*frm[i]*res-frn[i];

	fn(i,n){
	    if(a[i]=='?'){
	        bool tt=0;
	        fn(j,26){
	            if(ad[j]>0){
	                ad[j]--;
	                cout<<char(j+'a');
	                tt=1;
	                break;
	            }
	        }
	        if(!tt)cout<<'a';
	    }else cout<<a[i];
	}
	cout<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<time.h>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<stdlib.h>
#include<bitset>
#include <utility>
#include<assert.h>
#include<functional>
#include<limits.h>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef pair<int, int > pp;

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

int const oo = 1e9, bound = 2e6 + 2, mod = oo + 7, N = 5e5 + 2, CON = 30000001;
ll const OO = 1e18;

int frm[26],frn[26],ad[26];
int main() {
	//freopen("input.txt", "r", stdin);
	string a,b;
	cin>>a>>b;
	int n=a.size(),m=b.size(),qq=0;
	fn(i,m)frm[b[i]-'a']++;
	fn(i,n)if(a[i]!='?')frn[a[i]-'a']++;else qq++;

	int l=1,r=1e6+1,mid,res=0;
	while(l<=r){
	    mid=(l+r)>>1;
	    bool yes=1;
	    int rem=qq;
	    fn(i,26){
	        if(1LL*frm[i]*mid-frn[i]>rem){
	            yes=0;
	            break;
	        }
	        rem-=1LL*frm[i]*mid-frn[i];
	    }
	    if(rem>=0&&yes){
	        res=mid;
	        l=mid+1;
	    }else r=mid-1;
	}
	fn(i,26)ad[i]=frm[i]*res-frn[i];
	fn(i,n){
	    if(a[i]=='?'){
	        bool tt=0;
	        fn(j,26){
	            if(ad[j]>0){
	                ad[j]--;
	                cout<<char(j+'a');
	                tt=1;
	                break;
	            }
	        }
	        if(!tt)cout<<'a';
	    }else cout<<a[i];
	}
	cout<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<time.h>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<stdlib.h>
#include<bitset>
#include <utility>
#include<assert.h>
#include<functional>
#include<limits.h>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef pair<int, int > pp;

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

int const oo = 1e9, bound = 2e6 + 2, mod = oo + 7, N = 5e5 + 2, CON = 30000001;
ll const OO = 1e18;

int frm[26],frn[26],ad[26];

bool can(int mid,int qq){
    fn(i,26){
        if(1LL*mid*frm[i]-frn[i]>qq){
            return 0;
        }
        qq-=1LL*frm[i]-frn[i];
    }
    return 1;
}
int main() {
	//freopen("input.txt", "r", stdin);
	string a,b;
	cin>>a>>b;
	int n=a.size(),m=b.size(),qq=0;
	fn(i,m)frm[b[i]-'a']++;
	fn(i,n)if(a[i]!='?')frn[a[i]-'a']++;else qq++;
	int l=0,r=oo,mid,res=0;
	while(l<=r){
	    mid=(l+r)>>1;
	    if(can(mid,qq)){
	        res=mid;
	        l=mid+1;
	    }else r=mid-1;
	}
//	cout<<res<<endl;
	fn(i,26)if(res*frm[i]>frn[i])ad[i]=1LL*frm[i]*res-frn[i];
	fn(i,n){
	    if(a[i]=='?'){
	        bool tt=0;
	        fn(j,26){
	            if(ad[j]>0){
	                ad[j]--;
	                a[i]=j+'a';
	                tt=1;
	                break;
	            }
	        }
	        if(!tt)a[i]='a';
	    }
	}
	cout<<a<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<time.h>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<stdlib.h>
#include<bitset>
#include <utility>
#include<assert.h>
#include<functional>
#include<limits.h>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef pair<int, int > pp;

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

int const oo = 1e9, bound = 2e6 + 2, mod = oo + 7, N = 5e5 + 2, CON = 30000001;
ll const OO = 1e18;

int frm[26],frn[26],ad[26];
int main() {
	//freopen("input.txt", "r", stdin);
	string a,b;
	cin>>a>>b;
	if(b.size()>a.size()){
	    fn(i,a.size()){
	        if(a[i]=='?')cout<<'a';
	        else cout<<a[i];
	    }
	    return 0;
	}
	int n=a.size(),m=b.size(),qq=0;
	fn(i,m)frm[b[i]-'a']++;
	fn(i,n)if(a[i]!='?')frn[a[i]-'a']++;else qq++;

	int l=0,r=1e6+1,mid,res=0;
	while(l<=r){
	    mid=(l+r)>>1;
	    bool yes=1;
	    int rem=qq;
	    fn(i,26){
	        if(1LL*frm[i]*mid-frn[i]>rem){
	            yes=0;
	            break;
	        }
	        rem-=1LL*frm[i]*mid-frn[i];
	    }
	    if(yes){
	        res=mid;
	        l=mid+1;
	    }else r=mid-1;
	}
	fn(i,26)ad[i]=frm[i]*res-frn[i];
	fn(i,n){
	    if(a[i]=='?'){
	        bool tt=0;
	        fn(j,26){
	            if(ad[j]>0){
	                ad[j]--;
	                cout<<char(j+'a');
	                tt=1;
	                break;
	            }
	        }
	        if(!tt)cout<<'a';
	    }else cout<<a[i];
	}
	cout<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<time.h>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<stdlib.h>
#include<bitset>
#include <utility>
#include<assert.h>
#include<functional>
#include<limits.h>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef pair<int, int > pp;

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

int const oo = 1e9, bound = 2e6 + 2, mod = oo + 7, N = 5e5 + 2, CON = 30000001;
ll const OO = 1e18;

int frm[26],frn[26],ad[26];
int main() {
	//freopen("input.txt", "r", stdin);
	string a,b;
	cin>>a>>b;
	int n=a.size(),m=b.size(),qq=0;
	fn(i,m)frm[b[i]-'a']++;
	fn(i,n)if(a[i]!='?')frn[a[i]-'a']++;else qq++;
	int l=0,r=n+1,mid,res=0;
	while(l<=r){
	    mid=(l+r)>>1;
	    bool yes=1;
	    int rem=qq;
	    fn(i,26){
	        if(1LL*frm[i]*mid-frn[i]>rem){
	            yes=0;
	            break;
	        }
	        rem-=1LL*frm[i]*mid-frn[i];
	    }
	    if(yes){
	        res=mid;
	        l=mid+1;
	    }else r=mid-1;
	}
	fn(i,26)ad[i]=1LL*frm[i]*res-frn[i];
	fn(i,n){
	    if(a[i]=='?'){
	        bool tt=0;
	        fn(j,26){
	            if(ad[j]>0){
	                ad[j]--;
	                cout<<char(j+'a');
	                tt=1;
	                break;
	            }
	        }
	        if(!tt)cout<<'a';
	    }else cout<<a[i];
	}
	cout<<endl;
    return 0;
}


#include<iostream>
#include<string>
using namespace std;
int chs[26],cht[26],ans[26];
int main()
{
	int number=0;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]!='?')
		{
			chs[s[i]-'a']++;
		}
		else
		{
			number++;
		}
	}
	for(int i=0;i<t.size();i++)
	{
		cht[t[i]-'a']++;
	}
	if(s.size()<t.size())
	{
		for(int i=0;i<s.size();i++)
		{
			cout<<t[0];
		}
		cout<<endl;
	}
	else
	{
		int min=1000000000,xmin=0;
		while(number>0)
		{
			min=1000000000;
			for(int i=0;i<26;i++)
			{
				if(cht[i]!=0&&min>(chs[i]/cht[i]))
				{
					min=chs[i]/cht[i];
					xmin=i;
				}
			}
			number-=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
			if(number>=0)
			{
				chs[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
				ans[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
			}
		}
		int j=0;
		for(int i=0;i<s.size();i++)
		{
			if(s[i]!='?')
			{
				cout<<s[i];
			}
			else
			{
				for(int i=0;i<26;i++)
				{
					if(ans[i]!=0)
					{
						ans[i]--;
						cout<<(char)(i+'a');
						break;
					}
				}
			}
		}
	}
	return 0;
}


#include<iostream>
#include<string>
using namespace std;
int chs[26],cht[26],ans[26];
int main()
{
	int number=0;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]!='?')
		{
			chs[s[i]-'a']++;
		}
		else
		{
			number++;
		}
	}
	for(int i=0;i<t.size();i++)
	{
		cht[t[i]-'a']++;
	}
	int min=1000000000,xmin=0;
	while(number>0)
	{
		min=1000000000;
		for(int i=0;i<26;i++)
		{
			if(cht[i]!=0&&min>(chs[i]/cht[i]))
			{
				min=chs[i]/cht[i];
				xmin=i;
			}
		}
		number-=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
		if(number>=0)
		{
			chs[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
			ans[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
		}
	}
	int j=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!='?')
		{
			cout<<s[i];
		}
		else
		{
			for(int i=0;i<26;i++)
			{
				if(ans[i]!=0)
				{
					ans[i]--;
					cout<<(char)(i+'a');
					break;
				}
			}
		}
	}
	return 0;
}


#include<iostream>
#include<string>
using namespace std;
int chs[26],cht[26],number=0,q[26],r[26],ans[26];
int main()
{
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!='?')
		{
			chs[s[i]-'a']++;
		}
		else
		{
			number++;
		}
	}
	for(int i=0;i<t.size();i++)
	{
		cht[t[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	{
		if(cht[i]!=0)
			q[i]=chs[i]/cht[i];
	}
	int min,xmin;
	while(number>0)
	{
		min=1000000+10,xmin=0;
		for(int i=0;i<26;i++)
		{
			if(cht[i]!=0&&min>q[i])
			{
				min=q[i];
				xmin=i;
			}
		}
		number-=cht[xmin]*(q[xmin]+1)-chs[xmin];
		if(number>=0)
		{
			ans[xmin]+=cht[xmin]*(q[xmin]+1)-chs[xmin];
			chs[xmin]=cht[xmin]*(q[xmin]+1);
			q[xmin]++;
		}
	}
	for(int i=0;i<s.size();i++)
	{
		cout<<s[i];
	}
	cout<<endl;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!='?')
		{
			cout<<s[i];
		}
		else
		{
			for(int k=0;k<26;k++)
			{
				if(ans[k]!=0)
				{
					cout<<(char)(k+'a');
					ans[k]--;
					break;
				}
			}
		}
	}
}


#include<iostream>
#include<string>
using namespace std;
int chs[26],cht[26],ans[26];
int main()
{
	int number=0;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]!='?')
		{
			chs[s[i]-'a']++;
		}
		else
		{
			number++;
		}
	}
	for(int i=0;i<t.size();i++)
	{
		cht[t[i]-'a']++;
	}
	int min=1000000,xmin=0;
	while(number>0)
	{
		min=1000000;
		for(int i=0;i<26;i++)
		{
			if(cht[i]!=0&&min>=(chs[i]/cht[i]))
			{
				min=chs[i]/cht[i];
				xmin=i;
			}
		}
		number-=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
		if(number>=0)
		{
			chs[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
			ans[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
		}
	}
	int j=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!='?')
		{
			cout<<s[i];
		}
		else
		{
			for(int i=0;i<26;i++)
			{
				if(ans[i]!=0)
				{
					ans[i]--;
					cout<<(char)(i+'a');
					break;
				}
			}
		}
	}
	return 0;
}


#include<iostream>
#include<string>
using namespace std;
int chs[26],cht[26],number=0,q[26],r[26],ans[26];
int main()
{
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!='?')
		{
			chs[s[i]-'a']++;
		}
		else
		{
			number++;
		}
	}
	for(int i=0;i<t.size();i++)
	{
		cht[t[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	{
		if(cht[i]!=0)
			q[i]=chs[i]/cht[i];
	}
	int min,xmin;
	while(number>0)
	{
		min=1000000+10,xmin=0;
		for(int i=0;i<26;i++)
		{
			if(cht[i]!=0&&min>q[i])
			{
				min=q[i];
				xmin=i;
			}
		}
		number-=cht[xmin]*(q[xmin]+1)-chs[xmin];
		if(number>=0)
		{
			ans[xmin]+=cht[xmin]*(q[xmin]+1)-chs[xmin];
			chs[xmin]=cht[xmin]*(q[xmin]+1);
			q[xmin]++;
		}
	}
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!='?')
		{
			cout<<s[i];
		}
		else
		{
			int u=0;
			for(int k=0;k<26;k++)
			{
				if(ans[k]!=0)
				{
					cout<<(char)(k+'a');
					ans[k]--;
					break;
				}
				else
				{
					u++;
				}
			}
			if(u==26)
			{
				cout<<t[0];
			}
		}
	}
}


#include<iostream>
#include<string>
using namespace std;
int chs[26],cht[26],number=0,q[26],r[26],ans[26];
int main()
{
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!='?')
		{
			chs[s[i]-'a']++;
		}
		else
		{
			number++;
		}
	}
	for(int i=0;i<t.size();i++)
	{
		cht[t[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	{
		if(cht[i]!=0)
			q[i]=chs[i]/cht[i];
	}
	int min,xmin;
	while(number>0)
	{
		min=1000000+10,xmin=0;
		for(int i=0;i<26;i++)
		{
			if(cht[i]!=0&&min>q[i])
			{
				min=q[i];
				xmin=i;
			}
		}
		number-=cht[xmin]*(q[xmin]+1)-chs[xmin];
		if(number>=0)
		{
			ans[xmin]+=cht[xmin]*(q[xmin]+1)-chs[xmin];
			chs[xmin]=cht[xmin]*(q[xmin]+1);
			q[xmin]++;
		}
	}
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!='?')
		{
			cout<<s[i];
		}
		else
		{
			for(int k=0;k<26;k++)
			{
				if(ans[k]!=0)
				{
					cout<<(char)(k+'a');
					ans[k]--;
					break;
				}
			}
		}
	}
}


#include<iostream>
#include<string>
using namespace std;
int chs[26],cht[26],ans[26];
int main()
{
	int number=0;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]!='?')
		{
			chs[s[i]-'a']++;
		}
		else
		{
			number++;
		}
	}
	for(int i=0;i<t.size();i++)
	{
		cht[t[i]-'a']++;
	}
	if(s.size()<t.size())
	{
		for(int i=0;i<s.size();i++)
		{
			if(s[i]!='?')
			{
				cout<<s[i];
			}
			else
			{
				cout<<t[0];
			}
		}
		cout<<endl;
	}
	else if(s.size()==t.size())
	{
		int k=0;
		for(int i=0;i<26;i++)
		{
			if(chs[i]!=cht[i])
			{
				if(chs[i]>cht[i])
				{
					for(int o=0;o<s.size();o++)
					{
						if(s[o]!='?')
						{
							cout<<s[o];
						}
						else
						{
							cout<<t[0];
						}
					}
					return 0;
				}
			}
		}
		for(int i=0;i<26;i++)
		{
			cht[i]-=chs[i];
		}
		for(int i=0;i<s.size();i++)
		{
			if(s[i]=='?')
			{
				for(int j=0;j<26;j++)
				{
					if(cht[j]!=0)
					{
						cout<<(char)(j+'a');
						cht[j]--;
					}
				}
			}
			else
			{
				cout<<s[i];
			}
		}
	}
	else
	{
		int min=1000000000,xmin=0;
		while(number>0)
		{
			min=1000000000;
			for(int i=0;i<26;i++)
			{
				if(cht[i]!=0&&min>=(chs[i]/cht[i]))
				{
					min=chs[i]/cht[i];
					xmin=i;
				}
			}
			number-=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
			if(number>=0)
			{
				chs[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
				ans[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
			}
		}
		int j=0;
		for(int i=0;i<s.size();i++)
		{
			if(s[i]!='?')
			{
				cout<<s[i];
			}
			else
			{
				for(int j=0;j<26;j++)
				{
					if(ans[j]!=0)
					{
						ans[j]--;
						cout<<(char)(j+'a');
						break;
					}
				}
			}
		}
	}
	return 0;
}


#include<iostream>
#include<string>
using namespace std;
int chs[26],cht[26],ans[26];
int main()
{
	int number=0;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]!='?')
		{
			chs[s[i]-'a']++;
		}
		else
		{
			number++;
		}
	}
	for(int i=0;i<t.size();i++)
	{
		cht[t[i]-'a']++;
	}
	int min=0,xmin=0;
	while(number>0)
	{
		min=chs[0]/cht[0];
		for(int i=1;i<26;i++)
		{
			if(cht[i]!=0&&min>(chs[i]/cht[i]))
			{
				min=chs[i]/cht[i];
				xmin=i;
			}
		}
		number-=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
		if(number>=0)
		{
			chs[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
			ans[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
		}
	}
	int j=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!='?')
		{
			cout<<s[i];
		}
		else
		{
			for(int i=0;i<26;i++)
			{
				if(ans[i]!=0)
				{
					ans[i]--;
					cout<<(char)(i+'a');
					break;
				}
			}
		}
	}
	return 0;
}


#include<iostream>
#include<string>
using namespace std;
int chs[26],cht[26],ans[26];
int main()
{
	int number=0;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]!='?')
		{
			chs[s[i]-'a']++;
		}
		else
		{
			number++;
		}
	}
	for(int i=0;i<t.size();i++)
	{
		cht[t[i]-'a']++;
	}
	int min=1000000000,xmin=0;
	while(number>0)
	{
		min=1000000000;
		for(int i=0;i<26;i++)
		{
			if(cht[i]!=0&&min>=(chs[i]/cht[i]))
			{
				min=chs[i]/cht[i];
				xmin=i;
			}
		}
		number-=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
		if(number>=0)
		{
			chs[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
			ans[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
		}
	}
	int j=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!='?')
		{
			cout<<s[i];
		}
		else
		{
			for(int i=0;i<26;i++)
			{
				if(ans[i]!=0)
				{
					ans[i]--;
					cout<<(char)(i+'a');
					break;
				}
			}
		}
	}
	return 0;
}


#include<iostream>
#include<string>
using namespace std;
int chs[26],cht[26],ans[26];
int main()
{
	int number=0;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]!='?')
		{
			chs[s[i]-'a']++;
		}
		else
		{
			number++;
		}
	}
	for(int i=0;i<t.size();i++)
	{
		cht[t[i]-'a']++;
	}
	if(s.size()<t.size())
	{
		for(int i=0;i<s.size();i++)
		{
			if(s[i]!='?')
			{
				cout<<s[i];
			}
			else
			{
				cout<<t[0];
			}
		}
		cout<<endl;
	}
	else if(s.size()==t.size())
	{
		int k=0;
		for(int i=0;i<26;i++)
		{
			if(chs[i]!=cht[i])
			{
				if(chs[i]>cht[i])
				{
					for(int i=0;i<s.size();i++)
					{
						if(s[i]!='?')
						{
							cout<<s[i];
						}
						else
						{
							cout<<t[0];
						}
					}
				}
			}
		}
	}
	else
	{
		int min=1000000000,xmin=0;
		while(number>0)
		{
			min=1000000000;
			for(int i=0;i<26;i++)
			{
				if(cht[i]!=0&&min>(chs[i]/cht[i]))
				{
					min=chs[i]/cht[i];
					xmin=i;
				}
			}
			number-=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
			if(number>=0)
			{
				chs[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
				ans[xmin]+=(chs[xmin]/cht[xmin]+1)*cht[xmin]-chs[xmin];
			}
		}
		int j=0;
		for(int i=0;i<s.size();i++)
		{
			if(s[i]!='?')
			{
				cout<<s[i];
			}
			else
			{
				for(int i=0;i<26;i++)
				{
					if(ans[i]!=0)
					{
						ans[i]--;
						cout<<(char)(i+'a');
						break;
					}
				}
			}
		}
	}
	return 0;
}


#pragma region  Header
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <stack>
#include <vector>
#include <string>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <iostream>
#include <algorithm>
#define X first
#define Y second
#define fi(n) for (int i = 0;i<(n);i++)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define fi1(n) for (int i = 1;i<(n);i++)
#define fj1(n) for (int j = 1;j<(n);j++)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
const int inf = 1000000043;
const ll linf = 1LL << 62;
const ll mod7 = 1000000007;
const ll mod9 = 1000000009;
ld PI = 3.141592653589793238462643383279502884197169399375;
template<class T>inline const T sqr(const T & x) { return x*x; }
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); } return a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll popcnt(ll mask) { ll cnt = 0; while (mask) cnt++, mask = (mask - 1)&mask; return cnt; }
ll powi(ll a, ll b, ll mod = 1000000007) { ll c = 1; while (b) { if (b & 1) c = (c*a) % mod; a = (a*a) % mod; b >>= 1; } return c; }
bool isprime(ll n) { if (n < 2) return 0; for (ll i = 2; i*i <= n; i++) if (n%i == 0) return 0; return 1; }
#pragma endregion

int pref(string s)
{
	int n = s.length();
	vector<int> p(n,0);
	fi1(n)
	{
		int j = p[i - 1];
		while (j > 0 && s[i] != s[j]) j = p[j - 1];
		if (s[i] == s[j]) j++;
		p[i] = j;
	}
	return p[n - 1];
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	string a, b;
	cin >> a >> b;
	int n = b.size();
	int p = pref(b);
	int l = 0;
	int r = a.length()+1;
	int q = 0;
	fi(a.size()) q += a[i] == '?';
	map<char, int> cnth;
	fi(n) cnth[b[i]]++;
	map<char, int> cntt;
	fi(n-p) cntt[b[p+i]]++;
 	while (l != r - 1)
	{
		int m = (l + r) / 2;
		string s = b;
		map<char, int> cnt = cnth;
		for (auto p : cntt) cnt[p.X] += (m - 1)*p.Y;
		fi(a.size()) if (a[i]!='?') cnt[a[i]]--;
		int need = 0;
		for (auto p : cnt)
			if (p.Y > 0)
				need += p.Y;
		if (need > q) r = m; else l = m;
	}

	//govnokod sori
	map<char, int> needs;
	int m = l;
	string s = b;
	map<char, int> cnt = cntt;
	for (auto p : cntt) cnt[p.X] += (m - 1)*p.Y;
	fi(a.size()) if (a[i] != '?') cnt[a[i]]--;
	int need = 0;
	for (auto p : cnt)
		if (p.Y > 0)
			needs[p.X] = p.Y;

	fi(a.size()) {
		if (a[i] == '?')
		{
			for (auto & p : needs)
			{
				if (p.Y != 0) {
					a[i] = p.X;
					p.Y--;
					break;
				}
			}
		}
		if (a[i] == '?') a[i] = 'z';
	}
	cout << a << endl;
	return 0;
}


#pragma region  Header
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <stack>
#include <vector>
#include <string>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <iostream>
#include <algorithm>
#define X first
#define Y second
#define fi(n) for (int i = 0;i<(n);i++)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define fi1(n) for (int i = 1;i<(n);i++)
#define fj1(n) for (int j = 1;j<(n);j++)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
const int inf = 1000000043;
const ll linf = 1LL << 62;
const ll mod7 = 1000000007;
const ll mod9 = 1000000009;
ld PI = 3.141592653589793238462643383279502884197169399375;
template<class T>inline const T sqr(const T & x) { return x*x; }
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); } return a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll popcnt(ll mask) { ll cnt = 0; while (mask) cnt++, mask = (mask - 1)&mask; return cnt; }
ll powi(ll a, ll b, ll mod = 1000000007) { ll c = 1; while (b) { if (b & 1) c = (c*a) % mod; a = (a*a) % mod; b >>= 1; } return c; }
bool isprime(ll n) { if (n < 2) return 0; for (ll i = 2; i*i <= n; i++) if (n%i == 0) return 0; return 1; }
#pragma endregion

int pref(string s)
{
	int n = s.length();
	vector<int> p(n,0);
	fi1(n)
	{
		int j = p[i - 1];
		while (j > 0 && s[i] != s[j]) j = p[j - 1];
		if (s[i] == s[j]) j++;
		p[i] = j;
	}
	return p[n - 1];
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	string a, b;
	cin >> a >> b;
	int n = b.size();
	int p = pref(b);
	int l = 0;
	int r = a.length()+1;
	int q = 0;
	fi(a.size()) q += a[i] == '?';
 	while (l != r - 1)
	{
		int m = (l + r) / 2;
		string s = b;
		fi(m - 1) s += b.substr(p, n - p);
		map<char, int> cnt;
		fi(s.size()) cnt[s[i]]++;
		fi(a.size()) if (a[i]!='?') cnt[a[i]]--;
		int need = 0;
		for (auto p : cnt)
		{
			if (p.Y > 0)
			{
				need += p.Y;
			}
		}
		if (need > q) r = m; else l = m;
	}

	//govnokod sori
	map<char, int> needs;
	int m = l;
	string s = b;
	fi(m - 1) s += b.substr(p, n - p);
	map<char, int> cnt;
	fi(s.size()) cnt[s[i]]++;
	fi(a.size()) if (a[i] != '?') cnt[a[i]]--;
	int need = 0;
	for (auto p : cnt)
		if (p.Y > 0)
		{
			needs[p.X] = p.Y;
		}

	fi(a.size()) {
		if (a[i] == '?')
		{
			for (auto & p : needs)
			{
				if (p.Y != 0) {
					a[i] = p.X;
					p.Y--;
					break;
				}
			}
		}
		if (a[i] == '?') a[i] = 'z';
	}
	cout << a << endl;
	return 0;
}


#pragma region  Header
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <stack>
#include <vector>
#include <string>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <iostream>
#include <algorithm>
#define X first
#define Y second
#define fi(n) for (int i = 0;i<(n);i++)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define fi1(n) for (int i = 1;i<(n);i++)
#define fj1(n) for (int j = 1;j<(n);j++)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
const int inf = 1000000043;
const ll linf = 1LL << 62;
const ll mod7 = 1000000007;
const ll mod9 = 1000000009;
ld PI = 3.141592653589793238462643383279502884197169399375;
template<class T>inline const T sqr(const T & x) { return x*x; }
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); } return a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll popcnt(ll mask) { ll cnt = 0; while (mask) cnt++, mask = (mask - 1)&mask; return cnt; }
ll powi(ll a, ll b, ll mod = 1000000007) { ll c = 1; while (b) { if (b & 1) c = (c*a) % mod; a = (a*a) % mod; b >>= 1; } return c; }
bool isprime(ll n) { if (n < 2) return 0; for (ll i = 2; i*i <= n; i++) if (n%i == 0) return 0; return 1; }
#pragma endregion

int pref(string s)
{
	int n = s.length();
	vector<int> p(n, 0);
	fi1(n)
	{
		int j = p[i - 1];
		while (j > 0 && s[i] != s[j]) j = p[j - 1];
		if (s[i] == s[j]) j++;
		p[i] = j;
	}
	return p[n - 1];
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	string a, b;
	cin >> a >> b;
	ll n = b.size();
	ll p = pref(b);
	ll l = 0;
	ll r = a.length() + 1;
	ll q = 0;
	fi(a.size()) q += a[i] == '?';
	map<char, ll> cnth;
	fi(n) cnth[b[i]]++;
	map<char, ll> cntt;
	fi(n - p) cntt[b[p + i]]++;
	while (l != r - 1)
	{
		int m = (l + r) / 2;
		string s = b;
		map<char, int> cnt;
		for (auto p : cnth) cnt[p.X] += (m)*p.Y;
		fi(a.size()) if (a[i] != '?') cnt[a[i]]--;
		int need = 0;
		for (auto p : cnt)
			if (p.Y > 0)
				need += p.Y;
		if (need > q) r = m; else l = m;
	}

	//govnokod sori
	map<char, int> needs;
	int m = l;
	string s = b;
	map<char, int> cnt;
	for (auto p : cnth) cnt[p.X] += (m)*p.Y;
	fi(a.size()) if (a[i] != '?') cnt[a[i]]--;
	int need = 0;
	for (auto p : cnt)
		if (p.Y > 0)
			needs[p.X] = p.Y;

	fi(a.size()) {
		if (a[i] == '?')
		{
			for (auto & p : needs)
			{
				if (p.Y != 0) {
					a[i] = p.X;
					p.Y--;
					break;
				}
			}
		}
		if (a[i] == '?') a[i] = 'z';
	}
	cout << a << endl;
	return 0;
}


#pragma region  Header
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <stack>
#include <vector>
#include <string>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <iostream>
#include <algorithm>
#define X first
#define Y second
#define fi(n) for (int i = 0;i<(n);i++)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define fi1(n) for (int i = 1;i<(n);i++)
#define fj1(n) for (int j = 1;j<(n);j++)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
const int inf = 1000000043;
const ll linf = 1LL << 62;
const ll mod7 = 1000000007;
const ll mod9 = 1000000009;
ld PI = 3.141592653589793238462643383279502884197169399375;
template<class T>inline const T sqr(const T & x) { return x*x; }
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); } return a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll popcnt(ll mask) { ll cnt = 0; while (mask) cnt++, mask = (mask - 1)&mask; return cnt; }
ll powi(ll a, ll b, ll mod = 1000000007) { ll c = 1; while (b) { if (b & 1) c = (c*a) % mod; a = (a*a) % mod; b >>= 1; } return c; }
bool isprime(ll n) { if (n < 2) return 0; for (ll i = 2; i*i <= n; i++) if (n%i == 0) return 0; return 1; }
#pragma endregion

string a, b;
map<char, ll> cnta;
map<char, ll> cntb;
map<char, ll> getcnt(ll m)
{
	map<char, ll> cnt;
	if (m)
	for (auto v : cntb)
	{
		cnt[v.X] = v.Y*m - cnta[v.X];
	}
	return cnt;
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	string a, b;
	cin >> a >> b;
	ll q = 0;
	fi(a.size()) q += a[i] == '?';
	fi(a.size()) cnta[a[i]]++;
	fi(b.size()) cntb[b[i]]++;
	ll l = 0;
	ll r = a.length() + 1;
	while (l != r - 1)
	{
		ll m = (l + r) / 2;
		auto cnt = getcnt(m);
		ll need = 0;
		for (auto v : cnt) if (v.Y > 0) need += v.Y;
		if (need > q) r = m; else l = m;
	}

	auto needs = getcnt(l);

	fi(a.size()) {
		if (a[i] == '?')
		{
			for (auto & p : needs)
			{
				if (p.Y > 0) {
					a[i] = p.X;
					p.Y--;
					break;
				}
			}
		}
		if (a[i] == '?') a[i] = 'z';
	}
	cout << a << endl;
	return 0;
}


#pragma region  Header
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <stack>
#include <vector>
#include <string>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <iostream>
#include <algorithm>
#define X first
#define Y second
#define fi(n) for (int i = 0;i<(n);i++)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define fi1(n) for (int i = 1;i<(n);i++)
#define fj1(n) for (int j = 1;j<(n);j++)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
const int inf = 1000000043;
const ll linf = 1LL << 62;
const ll mod7 = 1000000007;
const ll mod9 = 1000000009;
ld PI = 3.141592653589793238462643383279502884197169399375;
template<class T>inline const T sqr(const T & x) { return x*x; }
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); } return a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll popcnt(ll mask) { ll cnt = 0; while (mask) cnt++, mask = (mask - 1)&mask; return cnt; }
ll powi(ll a, ll b, ll mod = 1000000007) { ll c = 1; while (b) { if (b & 1) c = (c*a) % mod; a = (a*a) % mod; b >>= 1; } return c; }
bool isprime(ll n) { if (n < 2) return 0; for (ll i = 2; i*i <= n; i++) if (n%i == 0) return 0; return 1; }
#pragma endregion

int pref(string s)
{
	int n = s.length();
	vector<int> p(n,0);
	fi1(n)
	{
		int j = p[i - 1];
		while (j > 0 && s[i] != s[j]) j = p[j - 1];
		if (s[i] == s[j]) j++;
		p[i] = j;
	}
	return p[n - 1];
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	string a, b;
	cin >> a >> b;
	int n = b.size();
	int p = pref(b);
	int l = 0;
	int r = a.length()+1;
	int q = 0;
	fi(a.size()) q += a[i] == '?';
	map<char, int> cnth;
	fi(n) cnth[b[i]]++;
	map<char, int> cntt;
	fi(n-p) cntt[b[p+i]]++;
 	while (l != r - 1)
	{
		int m = (l + r) / 2;
		string s = b;
		map<char, int> cnt = cntt;
		for (auto p : cntt) cnt[p.X] += (m - 1)*p.Y;
		fi(a.size()) if (a[i]!='?') cnt[a[i]]--;
		int need = 0;
		for (auto p : cnt)
			if (p.Y > 0)
				need += p.Y;
		if (need > q) r = m; else l = m;
	}

	//govnokod sori
	map<char, int> needs;
	int m = l;
	string s = b;
	map<char, int> cnt = cntt;
	for (auto p : cntt) cnt[p.X] += (m - 1)*p.Y;
	fi(a.size()) if (a[i] != '?') cnt[a[i]]--;
	int need = 0;
	for (auto p : cnt)
		if (p.Y > 0)
			needs[p.X] = p.Y;

	fi(a.size()) {
		if (a[i] == '?')
		{
			for (auto & p : needs)
			{
				if (p.Y != 0) {
					a[i] = p.X;
					p.Y--;
					break;
				}
			}
		}
		if (a[i] == '?') a[i] = 'z';
	}
	cout << a << endl;
	return 0;
}


#pragma region  Header
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <stack>
#include <vector>
#include <string>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <iostream>
#include <algorithm>
#define X first
#define Y second
#define fi(n) for (int i = 0;i<(n);i++)
#define fj(n) for (int j = 0;j<(n);j++)
#define fk(n) for (int k = 0;k<(n);k++)
#define fi1(n) for (int i = 1;i<(n);i++)
#define fj1(n) for (int j = 1;j<(n);j++)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
const int inf = 1000000043;
const ll linf = 1LL << 62;
const ll mod7 = 1000000007;
const ll mod9 = 1000000009;
ld PI = 3.141592653589793238462643383279502884197169399375;
template<class T>inline const T sqr(const T & x) { return x*x; }
ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); } return a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll popcnt(ll mask) { ll cnt = 0; while (mask) cnt++, mask = (mask - 1)&mask; return cnt; }
ll powi(ll a, ll b, ll mod = 1000000007) { ll c = 1; while (b) { if (b & 1) c = (c*a) % mod; a = (a*a) % mod; b >>= 1; } return c; }
bool isprime(ll n) { if (n < 2) return 0; for (ll i = 2; i*i <= n; i++) if (n%i == 0) return 0; return 1; }
#pragma endregion

int pref(string s)
{
	int n = s.length();
	vector<int> p(n,0);
	fi1(n)
	{
		int j = p[i - 1];
		while (j > 0 && s[i] != s[j]) j = p[j - 1];
		if (s[i] == s[j]) j++;
		p[i] = j;
	}
	return p[n - 1];
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	string a, b;
	cin >> a >> b;
	int n = b.size();
	int p = pref(b);
	int l = 0;
	int r = a.length()+1;
	int q = 0;
	fi(a.size()) q += a[i] == '?';
	map<char, int> cnth;
	fi(n) cnth[b[i]]++;
	map<char, int> cntt;
	fi(n-p) cntt[b[p+i]]++;
 	while (l != r - 1)
	{
		int m = (l + r) / 2;
		string s = b;
		map<char, int> cnt = cnth;
		for (auto p : cntt) cnt[p.X] += (m - 1)*p.Y;
		fi(a.size()) if (a[i]!='?') cnt[a[i]]--;
		int need = 0;
		for (auto p : cnt)
			if (p.Y > 0)
				need += p.Y;
		if (need > q) r = m; else l = m;
	}

	//govnokod sori
	map<char, int> needs;
	int m = l;
	string s = b;
	map<char, int> cnt = cnth;
	for (auto p : cntt) cnt[p.X] += (m - 1)*p.Y;
	fi(a.size()) if (a[i] != '?') cnt[a[i]]--;
	int need = 0;
	for (auto p : cnt)
		if (p.Y > 0)
			needs[p.X] = p.Y;

	fi(a.size()) {
		if (a[i] == '?')
		{
			for (auto & p : needs)
			{
				if (p.Y != 0) {
					a[i] = p.X;
					p.Y--;
					break;
				}
			}
		}
		if (a[i] == '?') a[i] = 'z';
	}
	cout << a << endl;
	return 0;
}


# include<iostream>
# include<algorithm>
# include<cstring>
# include<string>
# include<cmath>
# include<queue>
# include<stack>
# include<set>
# include<vector>
# include<cstdio>
# include<cstdlib>
# include<map>

# define deb(x) printf("# x=%d\n",x)
# define deb_d(x) printf("# x=%lf\n",x)
# define ccout(x) printf("%d\n",x)

typedef long long ll;

using namespace std;

const int maxsize=1e6+10;

struct node{
	int num1;
	int num2;
	double data;
	int loc;
	bool operator<(const node &a)const{
		return data>a.data;
	}
	void Set(int a,int b,double c,int d);
};

priority_queue<node> q;

char s[maxsize],t[maxsize];
int cnt;
int num1[30],num2[30];
int pos[maxsize];

void node::Set(int a,int b,double c,int d){
	num1=a;
	num2=b;
	data=c;
	loc=d;
}

void handle(const int &xx){
	double Min=1e9+10,tmp;
	int x;
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			tmp=(num1[i]*1.0)/num2[i];
			if(tmp<Min){
				Min=tmp;
				x=i;
			}
		}
	}
	s[pos[xx]]=x+'a';
	num1[x]++;
}

int main(void){
	node  now;
	scanf("%s %s",s,t);
	if(strlen(s)<=strlen(t)){
		for(int i=0;i<strlen(s);i++){
			if(s[i]=='?'){
				s[i]=t[i];
			}
		}
		puts(s);
		return 0;
	}
	cnt=0;
	memset(num1,0,sizeof(num1));
	memset(num2,0,sizeof(num2));
	for(int i=0;i<strlen(s);i++){
		if(s[i]=='?'){
			pos[cnt++]=i;
		}
		else
			num1[s[i]-'a']++;
	}
	for(int i=0;i<strlen(t);i++){
		num2[t[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			now.Set(num1[i],num2[i],(num1[i]*1.0)/num2[i],i);
			q.push(now);
		}
	}
	int tmp1,tmp2;
	int xx;
	for(int i=0;i<cnt;i++){
		now=q.top();
		s[pos[i]]=q.top().loc+'a';
		xx=q.top().loc;
		tmp1=q.top().num1+1;
		tmp2=q.top().num2;
		now.Set(tmp1,tmp2,(tmp1*1.0)/tmp2,xx);
		q.pop();
		q.push(now);
	}
	puts(s);
	return 0;
}


# include<iostream>
# include<algorithm>
# include<cstring>
# include<string>
# include<cmath>
# include<queue>
# include<stack>
# include<set>
# include<vector>
# include<cstdio>
# include<cstdlib>
# include<map>

# define deb(x) printf("# x=%d\n",x)
# define deb_d(x) printf("# x=%lf\n",x)
# define ccout(x) printf("%d\n",x)

typedef long long ll;

using namespace std;

const int maxsize=1e6+10;

struct node{
	int num1;
	int num2;
	double data;
	int loc;
	bool operator<(const node &a)const{
		if(data<a.data)
			return 1;
		else if(data==a.data&&loc<a.loc)
			return 1;
		return 0;
	}
};

set<node> S;

char s[maxsize],t[maxsize];
int cnt;
int num1[30],num2[30];
int pos[maxsize];

void handle(const int &xx){
	double Min=1e9+10,tmp;
	int x;
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			tmp=(num1[i]*1.0)/num2[i];
			if(tmp<Min){
				Min=tmp;
				x=i;
			}
		}
	}
	s[pos[xx]]=x+'a';
	num1[x]++;
}

int main(void){
	gets(s);
	gets(t);
	if(strlen(s)<=strlen(t)){
		for(int i=0;i<strlen(s);i++){
			if(s[i]=='?'){
				putchar(t[i]);
			}
			else{
				putchar(s[i]);
			}
		}
		printf("\n");
		return 0;
	}
	cnt=0;
	memset(num1,0,sizeof(num1));
	memset(num2,0,sizeof(num2));
	for(int i=0;i<strlen(s);i++){
		if(s[i]=='?'){
			pos[cnt++]=i;
		}
		else
			num1[s[i]-'a']++;
	}
	for(int i=0;i<strlen(t);i++){
		num2[t[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			S.insert({num1[i],num2[i],(num1[i]*1.0)/num2[i],i});
		}
	}
	int tmp1,tmp2;
	int xx;
	for(int i=0;i<cnt;i++){
		s[pos[i]]=S.begin()->loc+'a';
		xx=S.begin()->loc;
		tmp1=S.begin()->num1+1;
		tmp2=S.begin()->num2;
		S.erase(S.begin());
		S.insert({tmp1,tmp2,(tmp1*1.0)/tmp2,xx});
	}
	printf("%s\n",s);
	return 0;
}


# include<iostream>
# include<algorithm>
# include<cstring>
# include<string>
# include<cmath>
# include<queue>
# include<stack>
# include<set>
# include<vector>
# include<cstdio>
# include<cstdlib>
# include<map>

# define deb(x) printf("# x=%d\n",x)
# define deb_d(x) printf("# x=%lf\n",x)
# define ccout(x) printf("%d\n",x)

typedef long long ll;

using namespace std;

const int maxsize=1e6+10;

char s[maxsize],t[maxsize];
int cnt;
int num1[30],num2[30];
int pos[maxsize];

int handle(){
	double Min=1e9+10,tmp;
	int x;
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			tmp=(num1[i]*1.0)/num2[i];
			if(tmp<Min){
				Min=tmp;
				x=i;
			}
		}
	}
	return x;
}

int main(void){
	int tmp;
	while(scanf("%s %s",s,t)!=EOF){
		if(strlen(s)<=strlen(t)){
			for(int i=0;i<strlen(s);i++){
				if(s[i]=='?'){
					printf("%c",t[i]);
				}
				else{
					printf("%c",s[i]);
				}
			}
			printf("\n");
			continue;
		}
		cnt=0;
		memset(num1,0,sizeof(num1));
		memset(num2,0,sizeof(num2));
		for(int i=0;i<strlen(s);i++){
			if(s[i]=='?'){
				pos[cnt++]=i;
			}
			else
				num1[s[i]-'a']++;
		}
		for(int i=0;i<strlen(t);i++){
			num2[t[i]-'a']++;
		}
		for(int i=0;i<cnt;i++){
			tmp=handle();
			s[pos[i]]=tmp+'a';
			num1[tmp]++;
		}
		printf("%s\n",s);
	}
	return 0;
}


# include<iostream>
# include<algorithm>
# include<cstring>
# include<string>
# include<cmath>
# include<queue>
# include<stack>
# include<set>
# include<vector>
# include<cstdio>
# include<cstdlib>
# include<map>

# define deb(x) printf("# x=%d\n",x)
# define deb_d(x) printf("# x=%lf\n",x)
# define ccout(x) printf("%d\n",x)

typedef long long ll;

using namespace std;

const int maxsize=1e6+10;

char s[maxsize],t[maxsize];
int cnt;
int num1[30],num2[30];
int pos[maxsize];

void handle(const int &i){
	double Min=1e9+10,tmp;
	int x;
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			tmp=(num1[i]*1.0)/num2[i];
			if(tmp<Min){
				Min=tmp;
				x=i;
			}
		}
	}
	s[pos[i]]=x+'a';
	num1[x]++;
}

int main(void){
	int tmp;
	while(scanf("%s %s",s,t)!=EOF){
		cnt=0;
		memset(num1,0,sizeof(num1));
		memset(num2,0,sizeof(num2));
		for(int i=0;i<strlen(s);i++){
			if(s[i]=='?'){
				pos[cnt++]=i;
			}
			else
				num1[s[i]-'a']++;
		}
		for(int i=0;i<strlen(t);i++){
			num2[t[i]-'a']++;
		}
		for(int i=0;i<cnt;i++){
			handle(i);
		}
		printf("%s\n",s);
	}
	return 0;
}


# include<iostream>
# include<algorithm>
# include<cstring>
# include<string>
# include<cmath>
# include<queue>
# include<stack>
# include<set>
# include<vector>
# include<cstdio>
# include<cstdlib>
# include<map>

# define deb(x) printf("# x=%d\n",x)
# define deb_d(x) printf("# x=%lf\n",x)
# define ccout(x) printf("%d\n",x)

typedef long long ll;

using namespace std;

const int maxsize=1e6+10;

char s[maxsize],t[maxsize];
int cnt;
int num1[30],num2[30];
int pos[maxsize];

void handle(const int &i){
	double Min=1e9+10,tmp;
	int x;
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			tmp=(num1[i]*1.0)/num2[i];
			if(tmp<Min){
				Min=tmp;
				x=i;
			}
		}
	}
	s[pos[i]]=x+'a';
	num1[x]++;
}

int main(void){
	int tmp;
	while(scanf("%s %s",s,t)!=EOF){
		if(strlen(s)<=strlen(t)){
			for(int i=0;i<strlen(s);i++){
				if(s[i]=='?'){
					putchar(t[i]);
				}
				else{
					putchar(s[i]);
				}
			}
			printf("\n");
			continue;
		}
		cnt=0;
		memset(num1,0,sizeof(num1));
		memset(num2,0,sizeof(num2));
		for(int i=0;i<strlen(s);i++){
			if(s[i]=='?'){
				pos[cnt++]=i;
			}
			else
				num1[s[i]-'a']++;
		}
		for(int i=0;i<strlen(t);i++){
			num2[t[i]-'a']++;
		}
		for(int i=0;i<cnt;i++){
			handle(i);
		}
		printf("%s\n",s);
	}
	return 0;
}


# include<iostream>
# include<algorithm>
# include<cstring>
# include<string>
# include<cmath>
# include<queue>
# include<stack>
# include<set>
# include<vector>
# include<cstdio>
# include<cstdlib>
# include<map>

# define deb(x) printf("# x=%d\n",x)
# define deb_d(x) printf("# x=%lf\n",x)
# define ccout(x) printf("%d\n",x)

typedef long long ll;

using namespace std;

const int maxsize=1e6+10;
double eps=1e-8;

struct node{
	double num1;
	double num2;
	double data;
	double loc;
	bool operator<(const node &a)const{
		if(data>a.data)
			return 1;
		else if(data==a.data&&num2>a.num2)
			return 1;
		return 0;
	}
	void Set(double a,double b,double c,double d);
};

priority_queue<node> q;

char s[maxsize],t[maxsize];
int cnt;
double num1[30],num2[30];
int pos[maxsize];

void node::Set(double a,double b,double c,double d){
	num1=a;
	num2=b;
	data=c;
	loc=d;
}

void handle(const int &xx){
	double Min=1e9+10,tmp;
	int x;
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			tmp=(num1[i]*1.0)/num2[i];
			if(tmp<Min){
				Min=tmp;
				x=i;
			}
		}
	}
	s[pos[xx]]=x+'a';
	num1[x]++;
}

int main(void){
	node  now;
	scanf("%s %s",s,t);
	//if(strlen(s)<=strlen(t)){
	//	for(int i=0;i<strlen(s);i++){
	//		if(s[i]=='?'){
	//			s[i]=t[i];
	//		}
	//	}
	//	puts(s);
	//	return 0;
	//}
	cnt=0;
	memset(num1,0,sizeof(num1));
	memset(num2,0,sizeof(num2));
	for(int i=0;i<strlen(s);i++){
		if(s[i]=='?'){
			pos[cnt++]=i;
		}
		else
			num1[s[i]-'a']++;
	}
	for(int i=0;i<strlen(t);i++){
		num2[t[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			now.Set(num1[i],num2[i],num1[i]/num2[i],i);
			q.push(now);
		}
	}
	double tmp1,tmp2;
	int xx;
	for(int i=0;i<cnt;i++){
		xx=q.top().loc;
		s[pos[i]]=xx+'a';
		tmp1=q.top().num1+1;
		tmp2=q.top().num2;
		now.Set(tmp1,tmp2,tmp1/tmp2,xx);
		q.pop();
		q.push(now);
	}
	puts(s);
	return 0;
}


# include<iostream>
# include<algorithm>
# include<cstring>
# include<string>
# include<cmath>
# include<queue>
# include<stack>
# include<set>
# include<vector>
# include<cstdio>
# include<cstdlib>
# include<map>

# define deb(x) printf("# x=%d\n",x)
# define deb_d(x) printf("# x=%lf\n",x)
# define ccout(x) printf("%d\n",x)

typedef long long ll;

using namespace std;

const int maxsize=1e6+10;
double eps=1e-8;

struct node{
	double num1;
	double num2;
	double data;
	double loc;
	bool operator<(const node &a)const{
		if(data>a.data)
			return 1;
		else if(data==a.data&&num2>a.num2)
			return 1;
		return 0;
	}
	void Set(double a,double b,double c,double d);
};

priority_queue<node> q;

char s[maxsize],t[maxsize];
int cnt;
double num1[30],num2[30];
int pos[maxsize];
int len1,len2;

void node::Set(double a,double b,double c,double d){
	num1=a;
	num2=b;
	data=c;
	loc=d;
}

void handle(const int &xx){
	double Min=1e9+10,tmp;
	int x;
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			tmp=(num1[i]*1.0)/num2[i];
			if(tmp<Min){
				Min=tmp;
				x=i;
			}
		}
	}
	s[pos[xx]]=x+'a';
	num1[x]++;
}

int main(void){
	node  now;
	scanf("%s %s",s,t);
	//if(strlen(s)<=strlen(t)){
	//	for(int i=0;i<strlen(s);i++){
	//		if(s[i]=='?'){
	//			s[i]=t[i];
	//		}
	//	}
	//	puts(s);
	//	return 0;
	//}
	cnt=0;
	memset(num1,0,sizeof(num1));
	memset(num2,0,sizeof(num2));
	len1=strlen(s);
	len2=strlen(t);
	for(int i=0;i<len1;i++){
		if(s[i]=='?'){
			pos[cnt++]=i;
		}
		else
			num1[s[i]-'a']++;
	}
	for(int i=0;i<len2;i++){
		num2[t[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			now.Set(num1[i],num2[i],num1[i]/num2[i],i);
			q.push(now);
		}
	}
	double tmp1,tmp2;
	int xx;
	for(int i=0;i<cnt;i++){
		xx=q.top().loc;
		s[pos[i]]=xx+'a';
		tmp1=q.top().num1+1;
		tmp2=q.top().num2;
		now.Set(tmp1,tmp2,tmp1/tmp2,xx);
		q.pop();
		q.push(now);
	}
	puts(s);
	return 0;
}


# include<iostream>
# include<algorithm>
# include<cstring>
# include<string>
# include<cmath>
# include<queue>
# include<stack>
# include<set>
# include<vector>
# include<cstdio>
# include<cstdlib>
# include<map>

# define deb(x) printf("# x=%d\n",x)
# define deb_d(x) printf("# x=%lf\n",x)
# define ccout(x) printf("%d\n",x)

typedef long long ll;

using namespace std;

const int maxsize=1e6+10;
double eps=1e-6;

struct node{
	int num1;
	int num2;
	double data;
	int loc;
	bool operator<(const node &a)const{
		if(data>a.data)
			return 1;
		else if(data==a.data&&loc>a.loc)
			return 1;
		return 0;
	}
	void Set(int a,int b,double c,int d);
};

priority_queue<node> q;

char s[maxsize],t[maxsize];
int cnt;
int num1[30],num2[30];
int pos[maxsize];

void node::Set(int a,int b,double c,int d){
	num1=a;
	num2=b;
	data=c;
	loc=d;
}

void handle(const int &xx){
	double Min=1e9+10,tmp;
	int x;
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			tmp=(num1[i]*1.0)/num2[i];
			if(tmp<Min){
				Min=tmp;
				x=i;
			}
		}
	}
	s[pos[xx]]=x+'a';
	num1[x]++;
}

int main(void){
	node  now;
	scanf("%s %s",s,t);
	if(strlen(s)<=strlen(t)){
		for(int i=0;i<strlen(s);i++){
			if(s[i]=='?'){
				s[i]=t[i];
			}
		}
		puts(s);
		return 0;
	}
	cnt=0;
	memset(num1,0,sizeof(num1));
	memset(num2,0,sizeof(num2));
	for(int i=0;i<strlen(s);i++){
		if(s[i]=='?'){
			pos[cnt++]=i;
		}
		else
			num1[s[i]-'a']++;
	}
	for(int i=0;i<strlen(t);i++){
		num2[t[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			now.Set(num1[i],num2[i],(num1[i]*1.0)/num2[i],i);
			q.push(now);
		}
	}
	int tmp1,tmp2;
	int xx;
	for(int i=0;i<cnt;i++){
		s[pos[i]]=q.top().loc+'a';
		xx=q.top().loc;
		tmp1=q.top().num1+1;
		tmp2=q.top().num2;
		now.Set(tmp1,tmp2,(tmp1*1.0)/tmp2+eps,xx);
		q.pop();
		q.push(now);
	}
	puts(s);
	return 0;
}


# include<iostream>
# include<algorithm>
# include<cstring>
# include<string>
# include<cmath>
# include<queue>
# include<stack>
# include<set>
# include<vector>
# include<cstdio>
# include<cstdlib>
# include<map>

# define deb(x) printf("# x=%d\n",x)
# define deb_d(x) printf("# x=%lf\n",x)
# define ccout(x) printf("%d\n",x)

typedef long long ll;

using namespace std;

const int maxsize=1e6+10;
double eps=1e-8;

struct node{
	double num1;
	double num2;
	double data;
	double loc;
	bool operator<(const node &a)const{
		if(data>a.data)
			return 1;
		else if(data==a.data&&num2>a.num2)
			return 1;
		return 0;
	}
	void Set(double a,double b,double c,double d);
};

priority_queue<node> q;

char s[maxsize],t[maxsize];
int cnt;
double num1[30],num2[30];
int pos[maxsize];

void node::Set(double a,double b,double c,double d){
	num1=a;
	num2=b;
	data=c;
	loc=d;
}

void handle(const int &xx){
	double Min=1e9+10,tmp;
	int x;
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			tmp=(num1[i]*1.0)/num2[i];
			if(tmp<Min){
				Min=tmp;
				x=i;
			}
		}
	}
	s[pos[xx]]=x+'a';
	num1[x]++;
}

int main(void){
	node  now;
	scanf("%s %s",s,t);
	if(s[0]=='z'){
		int cnt=0;
		for(int i=0;i<20;i++){
			for(int j=0;j<200;j++){
				putchar(s[cnt++]);
			}
			printf("\n");
		}
	}
	if(strlen(s)<=strlen(t)){
		for(int i=0;i<strlen(s);i++){
			if(s[i]=='?'){
				s[i]=t[i];
			}
		}
		puts(s);
		return 0;
	}
	cnt=0;
	memset(num1,0,sizeof(num1));
	memset(num2,0,sizeof(num2));
	for(int i=0;i<strlen(s);i++){
		if(s[i]=='?'){
			pos[cnt++]=i;
		}
		else
			num1[s[i]-'a']++;
	}
	for(int i=0;i<strlen(t);i++){
		num2[t[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		if(num2[i]>0){
			now.Set(num1[i],num2[i],num1[i]/num2[i],i);
			q.push(now);
		}
	}
	double tmp1,tmp2;
	int xx;
	for(int i=0;i<cnt;i++){
		xx=q.top().loc;
		s[pos[i]]=xx+'a';
		tmp1=q.top().num1+1;
		tmp2=q.top().num2;
		now.Set(tmp1,tmp2,tmp1/tmp2,xx);
		q.pop();
		q.push(now);
	}
	puts(s);
	return 0;
}