Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 5725 |

@blackshadows | 5685 |

@akhayrutdinov | 5111 |

@mb1973 | 4989 |

@Quandray | 4908 |

@saiujwal13083 | 4156 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3511 |

@sushant_a | 3453 |

@KshamaGupta | 3318 |

@the_coder95 | 3302 |

Complete Leaderboard | |

Handle | Score |

@avaiesshaik782 | 662 |

@arpitsatnalika | 629 |

@code_it_ | 591 |

@prakharxyz | 583 |

@tujhekya | 542 |

@Rahul Jadhav 1 | 454 |

@sivanandh03 | 448 |

@satyam0460 | 429 |

@iamronak | 424 |

@imnm | 424 |

@18eumc107 | 421 |

Complete Leaderboard |

Given a string s containing 0's and 1's. You have to return a smallest positive integer **C**, such that the binary string can be cut into **C** pieces and each piece should be of the **power of 5 ** with no leading zeros.

**Input:**

The first line of the input contains **T **denoting the number of test cases. For each test case, there is a string **s.**

**Output:**

For each test case, the output is an integer **C**. If no such cuts are possible then return -1.

**Constraints:**

1<=s.length()<=50

**Note: **The string **s **is a binary string.

**Example:
Input**

3

101101101

1111101

00000

3

1

-1

**Explanation:
1.**We can split the given string into three “101”s, where 101 is the binary representation of 5.

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Cutting Binary String

...

Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.