Binary String With Substrings Representing Numbers From 1 To N

medium
1. You are given a string(str) consisting of only 0's and 1's, and a number N.
2. You have to find if the binary representation of every number from 1 to N can be represented by a substring of the given string.

Input Format

A string consisting of only 0's and 1's A number

Output Format

true/false

Constraints

1 <= length of string <= 1000
1 <= N <= 10^9

Example

Input
0110
3
Output
true
Previous
Number Of Paths Along The Edges In Upper Half Of A Square Matrix
Next
Valid Anagram

Related Questions