Skip to main content
Golfed a byte off. Hope I didn't butcher the explanation (first time editing someone else's non-CW answer, and funnily enough the one time I've edited a CW it was to add a trivial solution in Husk)
Source Link
Unrelated String
  • 23k
  • 3
  • 32
  • 55

Brachylog, 4 4 3 bytes

ġ=∋₁ġ=Ṁ

Try it online!Try it online!

Explanation

ġ=∋₁ġ=Ṁ    Implicit input, say "abcabc"
ġ      Split into chunks of equal lengths (except maybe the last one): ["abc","abc"]
 =    Constrain Apply the chunksconstraint tothat beall of the chunks are equal.,
  ∋₁  Get the secondand chunk,that makingthere sureare itmultiple exists:of "abc"them.

The program prints true. if the constraints can be satisfied, and false. if not.

Brachylog, 4 bytes

ġ=∋₁

Try it online!

Explanation

ġ=∋₁  Implicit input, say "abcabc"
ġ     Split into chunks of equal lengths (except maybe the last one): ["abc","abc"]
 =    Constrain the chunks to be equal.
  ∋₁  Get the second chunk, making sure it exists: "abc"

The program prints true. if the constraints can be satisfied, and false. if not.

Brachylog, 4 3 bytes

ġ=Ṁ

Try it online!

Explanation

ġ=Ṁ    Implicit input, say "abcabc"
ġ      Split into chunks of equal lengths (except maybe the last one): ["abc","abc"]
 =     Apply the constraint that all of the chunks are equal,
      and that there are multiple of them.

The program prints true. if the constraints can be satisfied, and false. if not.

Source Link
Zgarb
  • 42.8k
  • 4
  • 79
  • 259

Brachylog, 4 bytes

ġ=∋₁

Try it online!

Explanation

ġ=∋₁  Implicit input, say "abcabc"
ġ     Split into chunks of equal lengths (except maybe the last one): ["abc","abc"]
 =    Constrain the chunks to be equal.
  ∋₁  Get the second chunk, making sure it exists: "abc"

The program prints true. if the constraints can be satisfied, and false. if not.