fork(3) download
  1. fun main(args: Array<String>) {
  2. val texts = arrayOf<String>("hello how are you...","hiii", "hello how are you.............","hiiiiii")
  3. val re = """^(?!.*(.)\1{3,}).*""".toRegex()
  4. for(text in texts) {
  5. val isValid = re.containsMatchIn(text)
  6. println("${text}: ${isValid}")
  7. }
  8. }
Success #stdin #stdout 0.08s 37388KB
stdin
Standard input is empty
stdout
hello how are you...: true
hiii: true
hello how are you.............: false
hiiiiii: false