[Question]
  [
Part of [**Advent of Code Golf 2021**](https://codegolf.meta.stackexchange.com/q/24068/78410) event. See the linked meta post for details.
The story continues from [AoC2015 Day 5](https://adventofcode.com/2015/day/5), Part 2.
---
Santa needs help figuring out which strings in his text file are naughty or nice. He has already tried two sets of rules, but they're totally ad-hoc, cumbersome, and janky, so he comes up with a single rule that will rule them all:
* A string is nice if it contains a pattern `n..i..c..e` where the letters `n`, `i`, `c`, and `e` are equally far apart from each other.
In other words, a string is nice if, for some non-negative integer `x`, it matches the regex `n.{x}i.{x}c.{x}e`.
**Input:** A nonempty string of lowercase English letters (you can choose to take uppercase instead).
**Output:** Truthy or falsy indicating whether the input string is nice or not. You can choose to
* output truthy/falsy using your language's convention (swapping is allowed), or
* use two distinct, fixed values to represent true (affirmative) or false (negative) respectively.
Standard [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") rules apply. The shortest code in bytes wins.
## Test cases
Truthy:
```
nice
noizcue
aaaaanicezzzz
nnicceee
```
Falsy:
```
x
abc
ince
nnicce
nniccexe
precinct
```
  
[Answer]
# [J](http://jsoftware.com/), 35 bytes
```
1 e.[:,'nice'E."1]#~#$"1&><@=\@i.@#
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/DRVS9aKtdNTzMpNT1V31lAxjleuUVZQM1exsHGxjHDL1HJT/a3KlJmfkK6iHFJWWZFSqQ3hpChA9CF5@ZlVyKZJAIgiA1FQBAZI6oFByaipQIdRYt8ScYiRTK5BMSEpGcDLzUGwDm4LOr0ASKShKTQbqKVHn@g8A "J ‚Äì Try It Online")
Consider `f 'noizcue'`:
* `<@=\@i.@#` Create a bunch of identity matrixes, up to the input length:
```
‚îå‚îÄ‚î¨‚îÄ‚îÄ‚îÄ‚î¨‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚î¨‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚î¨‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚î¨‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚î¨‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îê
‚îÇ1‚îÇ1 0‚îÇ1 0 0‚îÇ1 0 0 0‚îÇ1 0 0 0 0‚îÇ1 0 0 0 0 0‚îÇ1 0 0 0 0 0 0‚îÇ
‚îÇ ‚îÇ0 1‚îÇ0 1 0‚îÇ0 1 0 0‚îÇ0 1 0 0 0‚îÇ0 1 0 0 0 0‚îÇ0 1 0 0 0 0 0‚îÇ
‚îÇ ‚îÇ   ‚îÇ0 0 1‚îÇ0 0 1 0‚îÇ0 0 1 0 0‚îÇ0 0 1 0 0 0‚îÇ0 0 1 0 0 0 0‚îÇ
‚îÇ ‚îÇ   ‚îÇ     ‚îÇ0 0 0 1‚îÇ0 0 0 1 0‚îÇ0 0 0 1 0 0‚îÇ0 0 0 1 0 0 0‚îÇ
‚îÇ ‚îÇ   ‚îÇ     ‚îÇ       ‚îÇ0 0 0 0 1‚îÇ0 0 0 0 1 0‚îÇ0 0 0 0 1 0 0‚îÇ
‚îÇ ‚îÇ   ‚îÇ     ‚îÇ       ‚îÇ         ‚îÇ0 0 0 0 0 1‚îÇ0 0 0 0 0 1 0‚îÇ
‚îÇ ‚îÇ   ‚îÇ     ‚îÇ       ‚îÇ         ‚îÇ           ‚îÇ0 0 0 0 0 0 1‚îÇ
‚îî‚îÄ‚î¥‚îÄ‚îÄ‚îÄ‚î¥‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚î¥‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚î¥‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚î¥‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚î¥‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îÄ‚îò
```
* `#$"1&>` Extend each row to the input length, filling extra rows with zeroes:
```
1 1 1 1 1 1 1
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
1 0 1 0 1 0 1
0 1 0 1 0 1 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
1 0 0 1 0 0 1
0 1 0 0 1 0 0
0 0 1 0 0 1 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
1 0 0 0 1 0 0
0 1 0 0 0 1 0
0 0 1 0 0 0 1
0 0 0 1 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
1 0 0 0 0 1 0
0 1 0 0 0 0 1
0 0 1 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 1 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
1 0 0 0 0 0 1
0 1 0 0 0 0 0
0 0 1 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 1 0 0
0 0 0 0 0 1 0
0 0 0 0 0 0 0
1 0 0 0 0 0 0
0 1 0 0 0 0 0
0 0 1 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 1 0 0
0 0 0 0 0 1 0
0 0 0 0 0 0 1
```
* `#$"1&>` Use those as masks to filter the input (rows of all zeroes elided to save space):
```
noizcue
nice   
ozu    
nze    
oc     
iu     
nc     
ou     
ie     
z      
nu     
oe     
i      
z      
c      
ne     
o      
i      
z      
c      
u      
n      
o      
i      
z      
c      
u      
e      
```
* `1 e.[:,'nice'` Is "nice" in any resulting rows?
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 8 bytes
```
ƒÅ‚Ç¨Œπ¬ª'≈í√Å√•
```
[Try it online!](https://tio.run/##yy9OTMpM/f//SOOjpjXndh7arX500uHGw0v//08EgbzM5NQqIAAA "05AB1E ‚Äì Try It Online") or [Try all cases!](https://tio.run/##S0oszvifnFiiYKeQnJ@SqpdfnJiUmapgY6Pg6u/2/0jjo6Y153Ye2q1@dNLhxsNL/wMFubjKMzJzUhWKUhNTFDLzuFLyuRQU9PMLSvQheqEUmnE2CipgtXmp//Myk1O58vIzq5JLU7kSQQAkUgUEXHlAVnJqaipXBVdiUjJXZh5IJVgMSlWkchUUpSYDJUq4AA)
```
ƒÅ         -- range from 1 to the length of the input s
 ‚Ç¨Œπ       -- for each value k in this range, push [s[0::k], ..., s[k-1::k]]
   ¬ª      -- join each inner list by spaces and the resulting strings by newlines
    '≈í√Å   -- dictionary compressed word "nice"
       √•  -- is this a substring?
```
Or look at the output of just [`ƒÅ‚Ç¨Œπ¬ª`](https://tio.run/##yy9OTMpM/f//SOOjpjXndh7a/f9/Xl5mZnJyRSoA)
[Answer]
# JavaScript (ES6), 59 bytes
```
s=>[...s].some((_,i)=>s.match(`n.{${i}}i.{${i}}c.{${i}}e`))
```
[Try it online!](https://tio.run/##dY7BCoMwEETv/QzpIYF2/yD@SCk13a7tFs2KSYsofnsaxZOkcxmYxwzztl/rsecunJ08KNYmelNeAMBfwUtLSt1OrE3pobUBX6pyMB0nnmfeHDenSuuI4rw0BI08Va0Kx0iF1od9LDziJ0fsoqU1JuWaiSHRWt2zIbd3x0zKLn9rHf8LhhzqesI0FxKKPw "JavaScript (Node.js) ‚Äì Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~17~~ ~~12~~ 11 bytes
```
·∫Üm√æJ·∫é‚Äú¬£u∆á¬ªe
```
[Try it online!](https://tio.run/##y0rNyan8///hrrbcw/u8Hu7qe9Qw59Di0mPth3an/n@4e8vh9kdNa45OerhzBpCO/P8/LzM5lSsvP7MquTSVKxEEQCJVQMCVB2Qlp6amclVwJSYlc2XmgVSCxaBURSpXQVFqMlCiBAA "Jelly ‚Äì Try It Online")
-5 bytes by adapting [emanresu A's approach](https://codegolf.stackexchange.com/a/237937/66833)  
-1 byte thanks to [ovs](https://codegolf.stackexchange.com/users/64121/ovs)!
## How it works
```
·∫Üm√æJ·∫é‚Äú¬£u∆á¬ªe - Main link. Takes a word W on the left
·∫Ü           - Contiguous substrings S of W
   J        - Yield the range 1 ‚â§ i ‚â§ len(W)
  √æ         - For each pair (S, i):
 m          -   Take the ith elements of s
    ·∫é       - Tighten into a list of strings
     ‚Äú¬£u∆á¬ª  - Compressed string; "nice"
          e - Is this in the list of strings?
```
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), ~~42~~ 41 bytes
```
n(.)*i(?<2-1>.)*(?(1)^)c(?<-2>.)*(?(2)^)e
```
[Try it online!](https://tio.run/##LcqxCoAwDATQPf8hpIJCO4sd/QuxhgxZIohC6c/XVHrLHY@7@RFNdcDtqIqzGwXjEia/2sSI3u2OTKbQIRhwrSrEoJcUehlSS5NiAbVFzAwZ0kkg2p6/9cr8AQ "Retina 0.8.2 ‚Äì Try It Online") Link includes test cases. Edit: Saved 1 byte by porting @ZaelinGoodman's regex. Explanation:
```
n(.)*i
```
Match `n`, followed by `x` characters, capturing `x` in capture group `1`, followed by `i`.
```
(?<2-1>.)*(?(1)^)c
```
Match `x` characters by popping from capture group `1`, simultaneously capturing into capture group `2`, followed by `c`.
```
(?<-2>.)*(?(2)^)e
```
Match `x` characters by popping from capture group `2`, followed by `e`.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 10 bytes
```
«é?≈ºvef‚Äõ√ü¬¶c
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLHjj/FvHZlZuKAm8OfwqZjIiwiIiwibm4uaS5jLmVlISEhIl0=)
```
«é          # Substrings
   v       # Each...
    e      # Get every nth character for each of...
 ?≈º        # 1...input length
     f     # flattened
         c # Includes
      ‚Äõ√ü¬¶  # Compressed string 'nice'
```
[Answer]
# [Python](https://docs.python.org/3/), 66, 64, 62, 61 (@dingledooper), 60 bytes (@Kevin Cruijssen)
```
f=lambda s,i=1:s>s[:i]and('nice'in s[::i])|f(s,i+1)|f(s[i:])
```
[Try it online!](https://tio.run/##bY3BCoMwDIbvewpvtmwX2a3gXkQ81NhiwMViO3Cyd@@iDEbE/5R8fH8S3mmY6J6zr0f77HpbxBvWlYmP2BhsLfWqJARXIhVMGOmPV@xcq31o0LQ6hxkpKf9Ttb78wYQrvCSzWzZz5UibKTgn9UWWOxA70vHjfuMELRKG2QGXE8P8BQ "Python 3 ‚Äì Try It Online")
[Old version](https://tio.run/##K6gsycjPM/7/P802JzE3KSVRoVgn09bQSknJpjg60yo2MS9FQz0vMzlVPTNPoTjayiozVrMmTQOoSNsQzAAp0vxfUJSZV6KRBlWqqcmFEMjPrEouRRVLBAGQyiogQFUNFE1OTUVVXoGqOSkZhZ@Zh24j2AwsQhWoggVFqclAzSVAwf8A "Python 3 ‚Äì Try It Online")
[Old version](https://tio.run/##K6gsycjPM/6fZhsDxDmJuUkpiQrFOpm2hlZKSjbF0ZlWsYl5KRppGkAxbUPNGiADJKaZX6Sel5mcqp6Zp1AcbWWVGav5v6AoM68EqBIioanJhRDIz6xKLkUVSwQBkMoqIEBVDRRNTk1FVV6BqjkpGYWfmYduI9gMLEIVqIIFRanJQM0lQMH/AA "Python 3 ‚Äì Try It Online")
[Old version](https://tio.run/##bY3BCsIwDIbvPkXZZSt6Kd6Ke5LaQ9d1GNB0tB3MvXzN9CARA4E/X/4/mZ/lFvFcp/5KfXePYXQin6BXumku2YC2Dsdu6ogdlYxJkDRKW5Itgg8toMhGa7CyzgmwkPezkPLwBRE2v3Dm9tqdGxV3E/UhcPvKw4NnM@Dvx/eNP2jlcE7BU7gQrC8 "Python 3 ‚Äì Try It Online")
[Old version](https://tio.run/##bY3BCsIwDIbvPkXZZSvuUrwV9yS1h67rMKDpaCvMvXzN9CARA4H8X/4/WZ7lGvFU5@FCfXP3cXIi9zAo3TTnbEBbh1M3d8SOSsYkaDRK2x5ItAg@tIAiG63ByrokwELuz0LKwxdE2PyDM7fX7tyouJuoD4HbVx4ePdOAvx/fN/6glcMlBU/hQrC@AA "Python 3 ‚Äì Try It Online")
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 72 bytes
```
lambda s:'nice'in[L:=range(len(s))]+[s[i::j+1][:4]for j in L for i in L]
```
[Try it online!](https://tio.run/##bY1BDsIgFET3noJdIV0ZXRiS3qA3QBYUQX9TfwnQpPbyCHVhMM5q/svMfPeKjxlPF@eT7a5pUs/hpkjgDYI2DaDoeecV3g2dDNLAmGxFEMD52B6l4GdpZ09GAkh6UizsVibnASO19LPD2OELZtj0UjNVVJJbVp3OVBtTx9e6POjqBvz9uG/8QWsNnTc6l2OG6Q0 "Python 3.8 (pre-release) ‚Äì Try It Online")
Same code pattern as yesterday?
[Answer]
# Excel, 78 bytes
```
=MAX(LET(q,REPT("?",SEQUENCE(LEN(A1))-1),COUNTIF(A1,"*n"&q&"i"&q&"c"&q&"e*")))
```
[![Results](https://i.stack.imgur.com/cgLRa.png)](https://i.stack.imgur.com/cgLRa.png)
Input is in the cell `A1`. Returns `1` for truthy and `0` for falsey.
* `REPT("?",SEQUENCE(LEN(a))-1)` creates an array of strings, all made entirely of `?` and varying in length from 1 to the length of the input minus 1. If the input is `nice` then this returns `['','?','??','???']`.
* `LET(q,REPT(~)` defines the results of the previous step to be `q` so we can reference it multiple times later using just the variable name and save bytes.
* `COUNTIF(A1,"*n"&q&"i"&q&"c"&q&"e*")` does the actual checking. `COUNTIF()` accepts wild cards where `*` is any number of characters (including zero) and `?` is exactly one character. Here, we search for something like `*n?i?c?e*` except the number of question marks varies with the results of the `REPT()` function. For a four letter word, we will search for all of these combinations: `*nice*`, `*n?i?c?e*`, `*n??i??c??e*`, and `*n???i???c???e*`.
* `MAX(LET(~,COUNTIF(~)))` returns the max value of all those `COUNTIF()` checks. Since we only ever check one cell in any one of those, the max value will be `1` even if it appears multiple times such as in `nicenice` or `nicenoiocoe`.
[Answer]
# TypeScript Types, 313 bytes
```
//@ts-ignore
type a<S,T>=T extends[infer C,...infer T]?S extends`${0 extends C?string:C}${infer S}`?a<S,T>:0:1;type b<S,T>=a<S,T>|(S extends`${string}${infer S}`?b<S,T>:never);type c<S,T=S,N=[],>=b<S,["n",...N,"i",...N,"c",...N,"e"]>|(T extends`${string}${infer T}`?c<S,T,[...N,0]>:0);type M<S>=1 extends c<S>?1:0
```
[Try it online!](https://www.typescriptlang.org/play?#code/PTACBcGcFoEsHMB2B7ATgUwFDgJ4Ad0ACAQwB4BlAGgBUA+AXmsPQA9x1EATSAbVkQBm6VIQDClAHRT+QkdQC6AfnLM2HbgAMAJAG8ADKvZdIYxZHCp+8AFyiAvrpnDC5OxsVkqda3usBGAG5cAkIAIwoaBk9IgB8AChVWI01dc0tEeAcdJxFXd3CvWmtEdAA3YQBKIPwiAGMI6noqADl6HnlKBgLKHgAiRF7JKWbKXthBqQkR3tqJ4dH0XvlaeKYk9UhtHTSrLJzCajdFeq8eyZG9ZZ8q4KIAWQoGP0MNwhPaRT8fAMxsGoODPRCA9+rBaotaD8QIQYQA9RR-ELUZ5AkEoWAAL1qAFcIVDgDDCPDEURqAAmQio0i9Yi02mIMHoDHMjG9SGYaFwhG3A4AZkpwOpiAZtXB6DxHIJXN+PIAYoDBb0WGz8YTiXKUYriKFZuzOUTuf9ZRSqWNEOCVZK1YaQrL+abhWCLXqpQaSYRZQAWAVokXglgS-XEoA)
[Answer]
# Python 3, 79 bytes:
```
import re
lambda s:any(re.findall(('.'*i).join('nice'),s)for i in range(len(s)))
```
[Try it online!](https://tio.run/##bY1BCsIwEEX3PUV2yYh040YEb@ImphMdSSdhGqHt5WMqiET8u/94fyYt@R75cExSaExRshLs/PlSgh2vg1XTyfJiBHtPPNgQjNG93hH0j0hsNJNDDfsJfBRFiliJ5RuagGwmAChJiLPxHxO6L4i0umfL7JbNXGtau1KH2OpzO766phP/fnzf@IPmFiZBV8e5wvIC)
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~25~~ 16 bytes
```
‚äôŒ∏‚äôŒ∏‚Ññ‚úÇŒ∏Œ∫Ôº¨Œ∏‚äïŒºnice
```
[Try it online!](https://tio.run/##XYyxCsMwDER/xXiSwJ06dgq0hQ6FQr/AyIIIVJU4TiBfr9prb3uPu6M5V/pmdX9VsQaTHXAXK5MqLClEjpjCv7Qhb8uWdYW3CvGwmsLDqPKHrXEBwcHtKrsUhqfYtoL0VtdnxHHSdxF7Lu7WgZjZT7v@AA "Charcoal ‚Äì Try It Online") Link is to verbose version of code. Outputs a Charcoal boolean, i.e. `-` if nice, nothing if not. Explanation:
```
 Œ∏                  Input string
‚äô                   Any index satisfies
   Œ∏                Input string
  ‚äô                 Any index satisfies
      Œ∏             Input string
     ‚úÇ              Sliced in steps of
           Œº        Inner index
          ‚äï         Incremented
       Œ∫            From outer index
        Ôº¨Œ∏          To the end of the string
    ‚Ññ               Count i.e. contains substring
            nice    Literal string `nice`
```
[Answer]
# [Rust (1.53+)](https://www.rust-lang.org/), 118 111 bytes
```
|mut s:&str|loop{(1..s.len()).any(|j|s.bytes().step_by(j).take(4).eq(*b"nice"))|(s=="")&&break ""!=s;s=&s[1..]}
```
[Try it online!](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=bc39c366434f7cf71b794613fe42843a "Rust ‚Äì Try It Online")
This only works on Rust 1.53 and newer as older Rust versions did not implement `IntoIterator` for arrays, but only for array references, so the `eq` comparison would end up trying to compare `u8` with `&u8` which would not work without doing something like `b"nice".iter().copied()`, a good 15 extra characters.
* -7 bytes by replacing the outer range with `loop` (thanks @AnttiP)
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 57 bytes
Developed on my own, then discovered as I checked the other solutions before posting that Neil beat me to this method with their excellent [Retina Answer](https://codegolf.stackexchange.com/a/237923/99902); so credit where credit is due.
Outputs False for Nice, and True for Naughty.
```
!($args-match'n(.)*i(?<2-1>.)*(?(1)$)c(?<-2>.)*(?(2)$)e')
```
[Try it online!](https://tio.run/##TY/LCsIwEEXX9itqiJqIFexWq4V@gKLuRKSG0Ub6kCbF0tpvjxMV8S7C4Z5khtyLB5QqgTQ1Lr24gduaPqNxeVVeFmuRjHI25WPJVgvfmy0R2YrNOOUCG8//Fj4WMOKmc6gGpaNYgcJRISO5FEAmJC9kIypLsY1tG4w1yALAqtrqs8BT5p9Xb/eD2uK9BIFaE/6/6@kOWqd32OyiSukiW59vIPQxbPd4I6Cn@RZUleqADfGL9MQ7pzPmBQ "PowerShell ‚Äì Try It Online")
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 71 bytes
```
s->sum(i=1,#s,sum(j=1,(#s-i)\3,[Vec(s)[i+j*k]|k<-[0..3]]==Vec("nice")))
```
[Try it online!](https://tio.run/##RYvBDsIgEER/hdALq9BoepV@hhfkUAk12yolxSa18d8R0MS57JudGd/NKG4@9kTGINqwPBjKI68CzzgkZFUQCJeGq7M1LIDC/bAb9Xs8CXWo60ZrKXNCHRpLASB23t9fLBDREj@jeyak2VDSpz1wor5dTqibcDNLwS4r/7ekkiVjrC3hWhpXkw@637bkf1ot1RA/ "Pari/GP ‚Äì Try It Online")
Outputs the number of "nice" patterns, truthy when this number is nonzero.
[Answer]
# Java 8, 94 bytes
```
s->{int i=s.length();for(;!s.matches(".*n.{"+i+"}i.{"+i+"}c.{"+i+"}e.*")&&i-->0;);return i<0;}
```
Outputs `false` for truthy results and `true` for falsey results.
[Try it online.](https://tio.run/##PZAxc8IwDIV3foXqgYvJxcdcF5bOZWHsdTBGgCBRcrHCUbj89lRpQzXYz3qne591DtdQnPeXIZYhJfgIxI8ZALFgewgRYTM@AXZ1XWJgiNlWWuIjJOvV6Gd6JAlCETbAsBpSsX7oNNAquRL5KKfM@kPdZv4luSpIPGHKjFuwe5icctPTU8SnQLcwdj6nolgvvfUtStcy0NvS94MfA5tuV2rglHutaQ@Vgk9on18Q7B/1mDvxCiZ5DwnhFQyTfoxruscOIYw1du5awKoiIo5C1Q3hBmEXdSERJ3O61GpajGqIcakpSTIDxtrfYIDtdxKsXN2JaxRASs6eCLlRhpxd/O/YaZn98AM)
**Explanation:**
```
s->{                // Method with String parameter and boolean return-type
  int i=s.length(); //  Start `i` at the length of the input-String
  for(;             //  Continue looping as long as:
      !s.matches(".*n.{"+i+"}i.{"+i+"}c.{"+i+"}e.*")
                    //   We haven't found "nice" yet (with `i` delimited chars)
      &&i-->0;);    //   And `i` hasn't reached 0 yet
                    //   (Decreasing `i` by 1 after every check with `i--`)
  return i<0;}      //  After the loop: return whether `i` is -1
```
Java's [String#matches](https://docs.oracle.com/javase/10/docs/api/java/lang/String.html#matches(java.lang.String)) checks the entire String with implicit leading `^` and trailing `$`, hence the need for the leading/trailing `.*` in the regex-check.
[Answer]
# [Zsh](https://www.zsh.org), 37 bytes
```
repeat $#1 {<*~*n$2i$2c$2e*;2+=?;}>$1
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m724qjhjwU01jeLUkvyCEoXUipLUvJTUlPSc_CSF1KKi1IrMEgUQp7g0qbhkaWlJmq7FTdWi1ILUxBIFFWVDhWobrTqtPBWjTBWjZBWjVC1rI21be-taOxVDiOLlmlw2NjYq9hDe6milvPzMquTSVKXYBRAhAA)
Outputs via exit code: `0` for naughty, `1` for nice. Requires options `extendedglob errexit globsubst`.
Explanation:
* `>$1`: create a file named {input}
* `repeat $#1`: do {length of input} times:
	+ `<*~`: search for a file *not* matching:
		- `*n$2i$2c$2e*`: construct a pattern using the variable `$2`
			* over the course of the loop, this makes `*nice*` `*n?i?c?e*` `*n??i??c??e*` etc.
			* `*` matches anything; `?` matches any single character. These patterns match all possible "nice" strings
	+ `errexit`: if there was no non-matching file (i.e., `*n$2i$2c$2e*` *did* match), then exit the program with code `1`
	+ append `?` to the variable `$2` (which starts out empty) to construct the new level of pattern
* I used a numbered variable `$2` rather than a named variable because it can be placed directly adjacent to a letter (like `$2i`)
* `globsubst` is needed so that `$2` can be treated as a pattern, not a literal string
* `extendedglob` is needed to enable the `~` pattern negation syntax
Combining `errexit` with pattern negation basically does a De Morgan's Law transformation on the whole program, matching *any* of the constructed patterns.
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~56 ...~~ 51 bytes
```
->s{(0..s.sum).any?{|x|s[/#{%w(n i c e)*(?.*x)}/]}}
```
[Try it online!](https://tio.run/##NY1NCsIwEIX3c4qAKEnR1AO0FkVw2QOIizROJdCmpbGY/p09JmLfZh4z33vT9cXgytQdTmaiR84NN33NuNBDNs12Nvd4M20/VBNFJEEW0YxHli3xY1ncq2meaZLc8vzKK6XRgFYSQTdqlD2CCAqb0Qu0dxIRIeAAhQjRy3lNWhCFBKVD/kf@h0VoO5T@8AZPA7QkvOW1aOmuZHvfs3r3BQ "Ruby ‚Äì Try It Online")
[Answer]
# [Factor](https://factorcode.org/) + `math.unicode`, ~~75~~ 74 bytes
```
[ all-subseqs [ dup length 4 / ‚åà group flip first "nice">array = ] ‚àÉ ]
```
[Try it online!](https://tio.run/##RY@xbsMwDER3f8XBe9wW6NSgc9GlS5ApyKAojCtUpRSJAhyvWTL0K/MjDhWjLYfjgY@ETgdjJaRpvXr/eHtBpmMhtpQ7GiSZjC9KTP5/jm8jn3fpCjsb9oQ@hRId94iJRE4xORb0xJSMd6MRFzhj2TSt7lOrLbjRlupMrTodtSpRb4kUNe1Q@c6qOp7P7vDPDNXqi1axtNMGxvtFLjtNmrHBvkR44l7DPuMB15/LnBMH71RcyoI50O/XXrHF9XLGdnp6BJsY/QldhvVk0nQD "Factor ‚Äì Try It Online")
```
all-subseqs [ ... ] ‚àÉ      ! Is there any subsequence in the input that...
dup length 4 / ‚åà group     ! ...when divided into quarters, with last quarter cut off...
flip first "nice">array =  ! ...the first column of these parts is equal to "nice"?
```
[Answer]
# [PHP](https://php.net/), 80 bytes
```
for($i=-1;$argn[++$i];)preg_match("~n.{{$i}}i.{{$i}}c.{{$i}}e~",$argn)?die(A):0;
```
[Try it online!](https://tio.run/##rU9BCsIwELznFSH00GIVvVpFRPQD9WZFYlztHtyEWqFY6tOt21jxA@4hM8nObmZc7trZwvF5tkUY4Hw4SQJdXGg3GAS4TyJXwOVw1aXJQ/WkUV0H2DTYo@kRnir2U9HihBAuo@k4aQWY3EqVUUbbdbqVq2W6TjNSiRD8F2jeuBOK0ICKGS0@zN1T3VX3/uDyPb4YgK4pVOUlR9MBUj/sBT9Wec7WDStK5nupb/LjsBaS609pXYFUfvL6td/IHLIRLZthNxWIr5OXdSVaurXDzRs "PHP ‚Äì Try It Online")
Port of [Arnauld's answer](https://codegolf.stackexchange.com/a/237929/90841), terminates with a truthy `A` if nice, or a falsy empty string if naughty.
Note: one of the input lines has to be a falsy one if you want to see the test cases, as the program terminates if truthy (for the same reason the `die` in the test cases is changed to a `print`)
[Answer]
# [R](https://www.r-project.org/), 78 bytes
Or **[R](https://www.r-project.org/)>=4.1, 71 bytes** by replacing the word `function` with `\`.
```
function(s){for(i in 0:nchar(s))F=F|grepl(gsub("x",i,"n.{x}i.{x}c.{x}e"),s);F}
```
[Try it online!](https://tio.run/##TYzNCsMgEITvfYqwJwUpPbfk6nski6YLZQ0aQfLz7FYTKZ3DMLPzsT7bPtvIuJBjEeRmnRfUEXePJ@N78OUmda/3yZv5I6YQRwEJFCng@5YOqobVDEgV5Esf2QpgwtJvNTlaMbYyVNVtLWp7qWhMA1LjRrwC8e/Pyf3n1NrsDRZuAZm/ "R ‚Äì Try It Online")
[Answer]
# [ayr](https://github.com/ZippyMagician/ayr), 29 bytes
Thanks to [this great answer](https://codegolf.stackexchange.com/a/237938/90265) for the method! I've never been very good at algorithms, so this was a great help.
```
v./'nice'E.&:,]#\:#$@1"i:&~&#
```
[Try it!](https://zippymagician.github.io/ayr#Zjo@/di4vJ25pY2UnRS4mOixdI1w6IyRAMSJpOiZ+JiM@/PShdLCc6ICcsNDgrZikiJ25pY2UnICdub2l6Y3VlJyAnYWFhYWFuaWNlenp6eicgJ25uaWNjZWVlJyAneCcgJ2luY2UnICdubmljY2V4ZScgJ3ByZWNpbmN0Jw@@//)
Glad I saw this challenge, I have only just implemented `E.`, nice to see it's already coming in handy!
# Explained
`i:&~&#` List of identity matrices of increasing size, up to the length of the string
`#$@1"` For each of these matrices, extend it to match the size of the string
`]#\:` Then filter the string using each row of the identity matrices as a boolean mask.
`'nice'E.&:,` Flatten this to a single string, find matches of the string `nice`
`v./` Or reduce. Is there a match?
[Answer]
# [Julia 1.0](http://julialang.org/), 65 bytes
```
!x=any(i->x>replace(x,Regex(join("nice",".{$i}"))=>1),keys(x).-1)
```
[Try it online!](https://tio.run/##LYzBCoMwEETv@xUx9JBAFLwW9CP6B2nclrVhlaiwWvrtqSl9lxlmhhm3SL6VnCvpPO@G6l76hHP0AY24Gz5RzDgRG80UUDvdvC/00dZ2fWvdC/fFiG3q1ubHlFRUxCqhHyIxLsaCOpkT8RrZVNEpfVXaqWgBecjlEXiiI2wIvlCS4wT4dAERQcDfAxCX5S/7iyDMCcNZrF8 "Julia 1.0 ‚Äì Try It Online")
[Answer]
# [SnakeEx](http://www.brianmacintosh.com/snakeex/spec.html), 30 bytes
```
m:n{s<>}i{s<>}c{s<>}e
s{P0}:.*
```
Matches (at least once) for truthy; doesn't match for falsey.
[Try it here!](http://www.brianmacintosh.com/snakeex/) No permalinks, so you'll need to enter the input and code yourself. (FYI: Newlines in the text boxes display correctly in Chrome but not in Firefox.) You can run all of the test cases at the same time; the program will find one match for each truthy case.
### Explanation
```
s{P0}:.*
s    :    Define snake s as
      .*  Match any run of 0 or more characters
 {  }     With these parameters:
  P        After matching, move the location pointer to the end of the match
   0       All matches of s are in group 0, meaning they must have the same length
m:n{s<>}i{s<>}c{s<>}e
m:                     Define main snake m as
                       Start out moving rightward (implicit)
  n                    Match "n"
   {s  }               Match snake s
     <>                in the same direction (rightward)
        i{s<>}         Match "i" followed by snake s again
              c{s<>}   Match "c" followed by snake s again
                    e  Match "e"
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 53 bytes
```
!(($t=$args)|?{$i++;"$t"-match"n.{$i}i.{$i}c.{$i}e"})
```
[Try it online!](https://tio.run/##ZZBRTsMwDIbfc4pQAmu1jgugiko7wBDjDSHUBW8LytqSOKJa17MXJy3VKvxgyZ9//7ZcVz9g7BG07sWeZ7ztb@JYYCYKc7DJ5akVarl8jARGq1OB8hiVD4Q6FbIMGaIu6TvG8pixNF6USsIiFftCW0gCqNRZujkrfHjlmWKuJioB5vKGKjRunN3J61KVYd9UDwb/STNjtQFJkzgxlvALv@Mt4xQCocGUC2hqkAif9BjxMXQMWKeRwD39K/c6j/ktt7UuEFV5CLq35@3aWaxOm90XWbzng7GPraNrrPWeo9kKvq92TcJXb54Nx0zw5W//OBwaHev6Xw "PowerShell ‚Äì Try It Online")
---
and 57 bytes alternatives:
```
!(($t=$args)|?{"$t"-match('nice'-replace'\B',($s+='.'))})
```
[Try it online!](https://tio.run/##ZZDRToQwEEXf@xV1rdJG8A@IRD9A4/qmxrB1dhfTBWynkSzLt@MUkCzxPnVO79yZTF39gHV7MKYXW57ytr@QUmAqcrtz6nTXrgSukkOOei@jstAQJRZqk9Pj7T6KpXA3aXQbKdWpvmMsk4zFkzEW29w4UAOoiqP2S5YHBeeRtHQT1QBLe0MVWj/1bvR5WZTDvLkeA/6TZsFqC5o6cWZM8RO/4i3jJIHQYMwFNDVohE86jvgYfyw4b5DANd0sC76A@SV3dBnEotwNvten9YN3WB0eN18U8Z6NwUFrT9s4FzKnsAS@z2bNxpcQno7LzPD5b/7UPHx0rOt/AQ "PowerShell ‚Äì Try It Online")
```
!(($t=$args)|?{"$t"-match((echo n i c e)-join($s+='.'))})
```
[Try it online!](https://tio.run/##ZZDRboMwDEXf8xVel41Eg/0BGtI@YNW6t2maaOaWVClQYjRUyrezBBgq6n3z8fW15bL4xcpmaEzPdxBD298JwSnmabW38vLSrjitomNKKhMCVVZADhoUoIwOhc4Ft09x8BxI2cm@YywRjIUiyLXCIOS71FiUAyj0WdVLlnp559lp6XZUIS7tjauoqqfZrboudT7sm@sx4JY0C1ZWqNwkzYxJuMADtAycOGFDIXBsSlSEP@45/HvsVGhrQw48up8l3ucx3IMtTUqk8/3g@1xvXmtLxfFte3ARX8kY7LWp3TXW@swpLMLT1a7Z@OHD4/GYGb7/75@Gh0bHuv4P "PowerShell ‚Äì Try It Online")
see also [Zaelin Goodman](https://codegolf.stackexchange.com/a/237982/80745)'s answer.
[Answer]
# BQN, 44 bytes
```
{‚à®¬¥("nice"‚â°/‚üúùï©)¬®‚àæ{(‚Üïl)‚åΩ¬®<l‚Üë‚àæ4‚•ä<ùï©‚Üë1}¬®1+‚Üïl‚Üê‚â†ùï©}
```
[Try it!](https://mlochbaum.github.io/BQN/try.html#code=RiDihpAge+KIqMK04oi+KCJuaWNlIuKNty/in5zwnZWpKcKo4oi+eyjihpVsKeKMvcKoPGzihpHiiL404qWKPPCdlanihpExfcKoMSvihpVs4oaQ4omg8J2VqX0KClQg4oaQIOKAolNob3cgRgpUICJuaWNlIgpUICJub2l6Y3VlIgpUICJhYWFhYW5pY2V6enp6IgpUICJubmljY2VlZSIKVCAieCIKVCAiYWJjIgpUICJpbmNlIgpUICJubmljY2UiClQgIm5uaWNjZXhlIgpUICJwcmVjaW5jdCIKCgo=)
Not sure if J can be ported here, but I'm sure there's much scope for golfing.
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 68 bytes
```
Array[c=Characters@#;""<>c[[Span@##]]==="nice"&,0{,,}+Tr[1^c],1,Or]&
```
[Try it online!](https://tio.run/##TU5NSwMxEL3vrxiysGgb0V5TU1a8eWlhewsRxpDYIJuUJMXdlv72Nd0o@C7z5n0M02M66B6TVTjdLWB/Cg68MRB9r8F5G0f4xuCs@4ywuK@2xohudAkHxpTv5XpWdhgSYwm/9K/QpZAbb946xuLMs1EZ4NNLCDgKxV8PGFAlHWJbrwl53ighuiO6tq6l5JwTZ5UmDX26UHpd7oNYvStJV3QbZDPt8sUkanjYgBE5Dw08ttWldGgFJD9@VqfC8Yabc84obt6U1sUeSuhDzdO6vwtz5h8dNLlOPw "Wolfram Language (Mathematica) ‚Äì Try It Online")
[Answer]
# Haskell + [hgl](https://gitlab.com/WheatWizard/haskell-golfing-library), 44 bytes
```
ay(Uc mp<bm(lt2<l<nb<Œ¥)(eq"nice")<uz)<ss<eu
```
### Explanation
Here we are looking for the subsequence "nice" where all the elements are evenly spaced. So the first things we do to the input are, pair it with it's indexes and get all possible subsequences.
```
ss<eu
```
Now that we have these we want to check if any meet the criteria. So we use `ay` for any.
```
ay ... <ss<eu
```
Now we want to check two separate things here. One is that the values are equal to `nice` and the second is that the indexes are evenly spaced. So it would be nice to unzip the two parts e.g. `[(0,'n'),(3,'i'),(4,'c'),(9,'e')] -> ([0,3,4,5],"nice")`.
```
ay(...<uz)<ss<eu
```
Now lets formulate our two tests. One is very easy:
```
eq"nice"
```
So now we want to determine if the indices are evenly spaced. We use `Œ¥` to determine the distances, then to check if the list only contains one value we do `lt2<l<nb`, that is we nub the list and check the length is less than 2.
```
lt2<l<nb<Œ¥
```
Now we use `bm` to map the two functions across our tuple:
```
ay(...<bm(lt2<l<nb<Œ¥)(eq"nice")<uz)<ss<eu
```
Lastly we convert this tuples booleans to a single boolean with `Uc mp`, which is and (`mp`) uncurried (`Uc`).
```
ay(Uc mp<bm(lt2<l<nb<Œ¥)(eq"nice")<uz)<ss<eu
```
## Reflection
With that I'd like to reflect a bit on ways we might improve hgl in light of this. It doesn't score very well here, 44 bytes is pretty long. There are a couple of things that could be improved.
* `lt2<l<nb` is really long to determine if a list is unique. This should probably be 1 function.
* Although it wouldn't help with the size here there probably should be some way to get subsequences of a particular size. We almost had to get all the subsequences and then filter by size. It also would make this much faster.
# Haskell + [hgl](https://gitlab.com/WheatWizard/haskell-golfing-library), 47 bytes
*Here's it solved with the parsing library*
```
pP$lF bn_(h'*> Én*>l<h')$is(rM hd)$p< É<p<"ice"
```
This is a good deal faster than the previous solution since it doesn't calculate every single subsequence.
## Explanation
Let's start with the string we are looking for:
```
"nice"
```
Now we want to parse these letters with things in between them. It would be nice to use an `is` which intersperses elements in a list. So lets turn these into parsers:
```
œá<"nice"
```
This creates a list of parsers each which parses a single letter. Now we want to intersperse it with something that parsers that all parse the same amount of characters. `hd` parses a single character so `rM hd` takes a number and parses exactly that many of the character.
However this is a function, not a parser so we can't intersperse it with our parsers. We could try to supply the argument first and then intersperse but it's easier to just make our char parsers into functions. They take a single argument, a number, and just ignore it. To do this we just map `p`, (short for `const`) across the list.
```
p<œá<"nice"
```
However we can't intersperse yet. Unfortunately the parsers for `rM hd` return a string while our other parsers return a character. Even though we don't care about the results we can't put them in a list together. So we have to change one of them. It's fairly easy to just make our char parsers into string parsers:
```
p< É<p<"nice"
```
`p` turns the char into a string, `É` turns the string into a parser `p` turns the parser into a parser function. Now we can intersperse:
```
is(rM hd)$p< É<p<"nice"
```
At this point we have a list of functions to parsers. We would like to supply all these parsers with the same argument since the gaps need to be the same sizes.
There are a couple of ways to do this. The first way that springs to mind is to use a traverse. `sQ` will pull all the arguments outside and it's super cheap. But it gets a little messy instead we can use a fold.
`bn_` is a sort of chaining operator like `>>=`.
```
bn_ :: Monad m => m a -> (a -> m b) -> m a
```
We can use a fold across the list to then chain everything together.
```
lF bn_ :: (Foldable t, Monad m) => m a -> t (a -> m b) -> m a
```
So if we apply this to what we have:
```
ghci> :t F(lF bn_)$is(rM hd)$p< É<p<"nice"
F(lF bn_)$is(rM hd)$p< É<p<"nice"
  :: (Integral i, Ord i) =>
     Parser (List Prelude.Char) i -> Parser (List Prelude.Char) i
```
This takes a parser which produces the initial integer and gives us back the parser we want.
Now the question is "How do we figure out which integer?" We could try and have it do something like, guess every size less than the list to see, but the best way seems to be to break the `n` off of nice and get the number just as the size of the first gap after the `n`.
To parse an `n` we can do:
```
 Én
```
Then after it we want a known number of characters. `h'` will parse any number of characters. And `l<` will convert that into a length.
```
 Én*>l<h'
```
And we also have to allow for arbitrary characters before the first `n`:
```
h'*> Én*>l<h'
```
So now we slot that in:
```
lF bn_(h'*> Én*>l<h')$is(rM hd)$p< É<p<"ice"
```
And we have a full parser. To turn that parser into a function we use `pP`, which returns true whenever there is a parse even if it doesn't consume the entire string.
## Reflection
The parsers are very powerful but disappointingly parser based answers are usually a bit shy of the non-parser answer. Here it's 3 bytes, which is the cost to invoke a parser.
* It's probably going to be eventually necessary to add a regex processor. Sometimes we will beat regex, but it would really open up a lot of opportunities.
* I should probably make a parser evaluator that matches the parser anywhere in the input. Would save a `h'*>` here and probably in a few other places.
* `lMy` could have been useful here but `l<h'` was shorter than `lMy hd`. Not sure if this is actionable, even shortening `lMy` to one character would leave them tied. But it's of interest to note.
[Answer]
# [Curry (PAKCS)](https://www.informatik.uni-kiel.de/%7Epakcs/), 63 bytes
```
f(_++'n':x++'i':y++'c':z++'e':_)=g$map length[x,y,z]
g[x,x,x]=1
```
[Try it online!](https://tio.run/##Sy4tKqrULUjMTi7@/z9NI15bWz1P3aoCSGWqW1UCqWR1qyoglapuFa9pm66Sm1igkJOal16SEV2hU6lTFcuVDmQAYayt4f/cxMw8BVuFNAWlvLzM5OTU1FSl/wA "Curry (PAKCS) ‚Äì Try It Online")
This returns `1` if the input string is nice, and nothing otherwise.
]