Repeated Substring Pattern — String Algorithms

Decide whether a short lowercase string is made by repeating a shorter piece of itself several times over.

String Algorithms · Easy

The problem

A wallpaper strip may be a single tile pattern stamped over and over. Decide whether the string can be built by taking some shorter piece of it and writing that piece two or more times in a row.

The story

A wallpaper strip of 1 to 12 lowercase letters may be a single tile stamped over and over. Decide whether the strip is some strictly shorter piece written two or more times in a row.

What to return

Constraints

Example

Input
s = "xyzxyz"
Output
true

Solve it

More in String Algorithms

All algorithm problems