The problem of the Repeated Substring Pattern is a popular **coding interview** question. Here you will be given a string, and you need to check if the given string can be formed by repeating a substring of the string. So, if you want to know how to solve this problem, this article is for you. This article will take you through how to solve the Repeated Substring Pattern problem using **Python**.

## Repeated Substring Pattern Problem

In the Repeated Substring Pattern problem, you will be given a string. To solve this problem, you need to check if the given string can be formed by repeating a substring of the string. For example, look at the input and output of this problem shown below:

- Input: āababā | Output: True

In this example, thereās a string given as an input āababā. And when a substring (āabā) of the string (āababā) is repeated twice, it forms the string as given in the input. So the output is true!

## Repeated Substring Pattern using Python

I hope you have now understood what the problem of the Repeated Substring Pattern means. Below is how you can solve this problem using the Python programming language:

def repeatedSubstringPattern(s): string = (s + s)[1:-1] return string.find(s) != -1 print(repeatedSubstringPattern("abcabcabcabc"))

Output: True

So this is how you can solve the repeated substring pattern problem using Python. You can find many more practice questions for coding interviews solved and explained using Python **here**.

### Summary

In the Repeated Substring Pattern problem, you will be given a string. To solve this problem, you need to check if the given string can be formed by repeating a substring of the string. I hope you liked this article on how to solve the Repeated Substring Pattern problem using Python. Feel free to ask valuable questions in the comments section below.