Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

fft

math

*2200

No tag edit access

The problem statement has recently been changed. View the changes.

×
I. Yet Another String Matching Problem

time limit per test

4 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputSuppose you have two strings *s* and *t*, and their length is equal. You may perform the following operation any number of times: choose two different characters *c*_{1} and *c*_{2}, and replace every occurence of *c*_{1} in both strings with *c*_{2}. Let's denote the distance between strings *s* and *t* as the minimum number of operations required to make these strings equal. For example, if *s* is abcd and *t* is ddcb, the distance between them is 2 — we may replace every occurence of a with b, so *s* becomes bbcd, and then we may replace every occurence of b with d, so both strings become ddcd.

You are given two strings *S* and *T*. For every substring of *S* consisting of |*T*| characters you have to determine the distance between this substring and *T*.

Input

The first line contains the string *S*, and the second — the string *T* (1 ≤ |*T*| ≤ |*S*| ≤ 125000). Both strings consist of lowercase Latin letters from a to f.

Output

Print |*S*| - |*T*| + 1 integers. The *i*-th of these integers must be equal to the distance between the substring of *S* beginning at *i*-th index with length |*T*| and the string *T*.

Example

Input

abcdefa

ddcb

Output

2 3 3 3

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Feb/28/2024 05:30:47 (j1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|