# Count Substrings | CodeChef

**URL:** <https://discuss.codechef.com/t/count-substrings-codechef/45764>\
**Category:** help\
**Created:** [December 5, 2019, 5:32pm UTC](https://discuss.codechef.com/t/count-substrings-codechef/45764 "2019-12-05T17:32:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nowie0301](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@nowie0301](https://discuss.codechef.com/u/nowie0301)\
**Post date:** [December 5, 2019, 5:32pm UTC](https://discuss.codechef.com/t/count-substrings-codechef/45764/1 "2019-12-05T17:32:05Z")

</div>

[https://www.codechef.com/viewsolution/28059162](https://www.codechef.com/viewsolution/28059162)

> **[CSUB Problem - CodeChef](https://www.codechef.com/problems/CSUB)**
>
> Practice your programming skills with easy level problem on Data Structures.

---

<div class="post-metadata">

**Author:** ![ssjgz](https://discuss.codechef.com/user_avatar/discuss.codechef.com/ssjgz/32/346011_2.png) [@ssjgz](https://discuss.codechef.com/u/ssjgz)\
**Post date:** [December 5, 2019, 5:32pm UTC](https://discuss.codechef.com/t/count-substrings-codechef/45764/2 "2019-12-05T17:32:27Z")

</div>

Please either [format your code](https://discuss.codechef.com/t/tutorial-color-format-the-code/36585) or link to your submission - the forum software has mangled it and it won’t compile! 🙂

---

<div class="post-metadata">

**Author:** ![nowie0301](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@nowie0301](https://discuss.codechef.com/u/nowie0301)\
**Post date:** [December 5, 2019, 5:37pm UTC](https://discuss.codechef.com/t/count-substrings-codechef/45764/3 "2019-12-05T17:37:13Z")

</div>

@ssjgz Sorry its my first time here😁

---

<div class="post-metadata">

**Author:** ![ssjgz](https://discuss.codechef.com/user_avatar/discuss.codechef.com/ssjgz/32/346011_2.png) [@ssjgz](https://discuss.codechef.com/u/ssjgz)\
**Post date:** [December 5, 2019, 5:47pm UTC](https://discuss.codechef.com/t/count-substrings-codechef/45764/4 "2019-12-05T17:47:23Z")

</div>

No problem 🙂

Consider a testcase where T=1, N=79987, and s consists of N `1`s.

---

<div class="post-metadata">

**Author:** ![nowie0301](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@nowie0301](https://discuss.codechef.com/u/nowie0301)\
**Post date:** [December 5, 2019, 5:59pm UTC](https://discuss.codechef.com/t/count-substrings-codechef/45764/5 "2019-12-05T17:59:03Z")

</div>

@ssjgz thank you so much for your response 😍  
Got AC!!

---

<div class="post-metadata">

**Author:** ![ssjgz](https://discuss.codechef.com/user_avatar/discuss.codechef.com/ssjgz/32/346011_2.png) [@ssjgz](https://discuss.codechef.com/u/ssjgz)\
**Post date:** [December 5, 2019, 5:59pm UTC](https://discuss.codechef.com/t/count-substrings-codechef/45764/6 "2019-12-05T17:59:35Z")

</div>

Great; you’re welcome 🙂
