1-
function Dnastr (s) { //ps: No AC, see bug Please indicate if (s.length>=1&&s.length<=50) { var rege=/^[a-z] +$/g; if (Rege.exec (s)) { var reg=/[atcg]{1,4}/g; var tmp= s.match (reg); var lens=[]; var max=0; for (var key in tmp) { lens.push (tmp[key].length); } for (var key in lens) { if (Lens[key] > max) { max = Lens[key]; } } return Max;}} } var s= "Tarcat" Console.log (DNASTR (s));
2-
function Issame (str) { //determines if the string var begin = 0 var end = Str.length/2 while (End < Str.length && Str[begin] = = Str[end]) { begin++ end++ } if (end = = Str.length ) { return true } return false}function isostring (str) { //after removing several characters from the end, determine whether or not a string of var max = 0 if (str.length <= 1) { return str.length } while (Str.length >=2) { str = str.slice (0,str.length-2) if (Issame (str)) { //calls the even-string judgment method return Str.length } } return 0}console.log (isostring ("Abaababaab"))
3-
PS: See the bug to help point out, Xie
JS Programming Little Practice 2の Cattle