String Subsequence

//a new way i developed to find the subsequence of a string without using a map. I’ll explain the code when I have time

//array
array=[‘green’,‘chewakan’,‘been’,‘gral’,‘ap’,‘hsetyo’,‘apple’,‘able’,];
//string
str=‘grapbeenple’;
//Make map for the string
let verify=[]

//function to split string and test them
function burst(minor){
major=str
sub=minor;
minor=minor.split("");
major=major.split("");
tf=[];

for(let i=0;i<minor.length;i++){
	for(let j=0;j<major.length;j++){
		
		if(minor[i]===major[j]){
			tf.push(true)
			
			major=major.slice(j+1)
			break;
		}
	}
}
console.log()
if(tf.length===sub.length){
	verify.push(sub)
}

}

array.forEach(burst)
console.log(’’.repeat(40))
console.log(The Sequences of "${str}" are :)
console.log(verify)
console.log(’
’.repeat(40))
console.log(" ")

function mlen(arr){
lstr=’’
larr=[]
for(element of arr){
if(element.length>lstr.length){
lstr=element
}
}
for(element of arr){
if (element.length===lstr.length){
larr.push(element)
}
}
console.log(“The longest words are :”)

console.log(larr)

}
mlen(verify)