Loading Now

primeString

The string is called prime if it cannot be constructed by concatenating some (more than one) equal strings together.

Given a string, determine if it is a prime string or not.

Example

  • For s = "abca", the output should be primeString(s) = true
  • For s = "xyxy", the output should be primeString(s) = false

Input/Output

  • [execution time limit] 1 seconds 

  • [input] string s

Guaranteed constraints:

1 ≤ s.length ≤ 30000.

s[i] only contains lower alphabet characters.

  • [output] boolean

Post Comment

Contact