Good Evening, I’ve been going a hacker-Rank > Mount-Blue Job Challenge whose description is something like this :-

## Separate the Numbers

A numeric string, s, is *beautiful* if it can be split into a sequence of two or more positive integers, a(1),a(2) ,…,a(n) satisfying the following conditions:

1.a(i)-a(i-1)=1 for any1<i<=n (i.e., each element in the sequence is 1 more than the previous element).

2. No a(i) contains a leading zero. For example, we can split, s=10203 into the sequence {1,02,03} , but it is not beautiful because 02 and 03 have leading zeroes.

3. The contents of the sequence cannot be rearranged. For example, we can split s = 312 into the sequence {3,1,2} , but it is not beautiful because it breaks our first constraint (i.e., ).

The diagram below depicts some beautiful strings:

Perform q queries where each query consists of some integer string s . For each query, print whether or not the string is beautiful on a new line. If it is beautiful, print `YES x`

, where ‘x’ is the first number of the increasing sequence. If there are multiple such values of ‘x’ , choose the smallest. Otherwise, print `NO`

.

The code which I have come up is something like this

```
function separateNumbers(s) {
// Write your code here
let strEle = []; let ele = ''
let len = parseInt(s.length/2)
for(let i=0; i<len; i++){
ele = ele + s[i]
strEle.push(parseInt(ele))
}
let posStr = []
for(let i=0; i<len; i++){
let d = strEle[i]; ele = ''
for(let j=0; j<s.length; j++){
if(ele.length<s.length)
ele = ele + d++
}
posStr.push(ele)
}
let cond = 0; let start = 0
for(let i=0; i<len; i++){
if(s==posStr[i]){
cond++
start = strEle[i]
}
}
if(cond>0){
console.log('YES', start)
}
else
console.log('NO')
console.log(s)
console.log(strEle)
console.log(posStr)
return ''
}
let s = separateNumbers('1234')
console.log(s)
```

This code runs perfectly for most of the cases but there are three cases for which this code is giving wrong answer (case-4, case-16, case-18). I’m unable to find out what parameters are there inside these three cases if you know please help me find it