In this kata you need to build a function to return either `true/True` or `false/False` if a string can be seen as the repetition of a simpler/shorter subpattern or not.

For example:

```cpp,java
hasSubpattern("a") == false; //no repeated pattern
hasSubpattern("aaaa") == true; //created repeating "a"
hasSubpattern("abcd") == false; //no repeated pattern
hasSubpattern("abababab") == true; //created repeating "ab"
hasSubpattern("ababababa") == false; //cannot be entirely reproduced repeating a pattern
```
```python
has_subpattern("a") == False #no repeated pattern
has_subpattern("aaaa") == True #created repeating "a"
has_subpattern("abcd") == False #no repeated pattern
has_subpattern("abababab") == True #created repeating "ab"
has_subpattern("ababababa") == False #cannot be entirely reproduced repeating a pattern
```
Strings will never be empty and can be composed of any character (just consider upper- and lowercase letters as different entities) and can be pretty long (keep an eye on performances!).

If you liked it, go for the [next kata](https://www.codewars.com/kata/string-subpattern-recognition-ii/) of the series!

Difficulty: introductory

Starter code:

def has_subpattern(string):
	

Solutions:
def has_subpattern(string):
    return (string * 2).find(string, 1) != len(string)

import re

def has_subpattern(string):
    return bool(re.match(r'(.+)\1+$', string))

def has_subpattern(string):
    s = len(string)
    for i in range(1,s//2+1):
        if s % i == 0:
            q = s//i
            if string[:i] * q == string:
                return True
    return False

import re

def has_subpattern(s):
    return bool(re.search(r'^(.+)\1+$', s))

has_subpattern=lambda s:s in(2*s)[1:-1]

import re
def has_subpattern(s):
    return re.search(r'^(.+?)\1{1,}$', s) != None

def has_subpattern(s):
      l = len(s)
      for i in range(1,l//2+1):
         if not l%i and s[:i]*(l//i) == s : 
             return True
      return False  

def has_subpattern(stg):
    l = len(stg)
    for k in range(2, int(l**0.5) + 1):
        if l % k == 0:
            if any(len({stg[i:i+s] for i in range(0, l, s)}) == 1 for s in (l // k, k)):
                return True
    return False

# one-liner
    #return any(any(len({stg[i:i+s] for i in range(0, len(stg), s)}) == 1 for s in (len(stg) // k, k)) for k in range(2, int(len(stg)**0.5)+1) if len(stg) % k == 0)


import re
def has_subpattern(string):
    #print(string)
    n = len(string)
    if n == 1: return False
    l, h = '{}'
    for i in range(1,n):
        #print(f'({string[:i]}){l}{n/i}{h}')
        if n % i == 0 and string[:i] * (n//i) == string:
            #print(string[:i])
            return True
    return False

def has_subpattern(s):
    return False if (s + s).find(s, 1, -1) == -1 else True