Under construction

Still being built. Things may change

Boundary Spell

Time limit2sMemory limit1024 MB

Summary
Given a string w, output a binary string where position i is 1 if the i-th cyclic shift of w has a nonempty proper prefix that is also a suffix.
Level

Medium6 of 10

Topics
String matching, String
Solved
No attempts yet

Problem

The great wizard Merlin is developing a new spell to protect the border of the Nearby Kingdom. To analyze the spell in more detail, Merlin wants to find its magic code and compare it with the codes recommended in the spellbooks.

The spell is a word ww of length nn, made of magic runes written as lowercase Latin letters. A spell is called nontrivial if it has a nonempty prefix, different from the whole spell, that is also a suffix of it. For example, abababa is nontrivial because its prefix ababa is also its suffix. aababab is not nontrivial.

Merlin considers all cyclic shifts of ww from 1 to nn. The ii-th cyclic shift starts at the ii-th character of the original spell. For example, the first cyclic shift of abababa is abababa, the second is bababaa, and the seventh is aababab.

The magic code of spell ww, written B(w)B(w), is a word of nn characters, each 0 or 1. The ii-th character of B(w)B(w) is 1 if the ii-th cyclic shift of ww is nontrivial, and 0 otherwise. For example, the magic code of abababa is 1011110.

Given spell ww, find its magic code.

Input

The input file contains the spell ww, consisting of lowercase Latin letters. Its length does not exceed 100,000.

Output

Print the magic code of the given spell.

Examples1

  1. Example 1

    Input
    abababa
    
    Expected output
    1011110