Question: HandsOn 1 : Periodic String You are given a binary string S , consisting of O ' s and 1 ' s . A string

HandsOn
1: Periodic String
You are given a binary string S, consisting of O's and 1's.
A string B has period K if B[i]=B[i]+K for all i from 1 to |B|-K.
Your task is to find a string T which satisfies the following conditions:
|T|2**|S|
S is a subsequence of T
T has the smallest period possible.
Note:
|B| denotes the length of string B.
Input Format
The first line contains a string, S, denoting the given string.
Constraints
1len(S)105
Sample Test Cases
Case 1
Input:
00000
Output:
00000
Explanation:
Given S=00000
T can be "00000" as it satisfies all of the given conditions.
Case 2
Input:
10101010
Output:
1010101010101010
Explanation:
Given S=10101010
T can be "1010101010101010" as it satisfies all of the given conditions.
Case 3
Input:
11111
Output:
11111
Explanation:
Given S=11111
T can be "11111" as it satisfies all of the given conditions.
 HandsOn 1: Periodic String You are given a binary string S,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!