 &status);
    }
    else {
        Normalizer::normalize(inputString, norm_mode, 0, normalizedString, status);
        if (U_FAILURE(status)) {
            return 0;
        }
        charPositions.resize(normalizedString.length() + 1);
        Normalizer normalizer(charString.elems(), inputLength, norm_mode);
        int32_t index = 0;
        charPositions[0] = 0;
        while(index < normalizer.endIndex()){
            /* UChar32 uc = */ normalizer.next();
            charPositions[++numChars] = index = normalizer.getIndex();
        }
        utext_openUnicodeString(&normalizedText, &normalizedString, &status);
    }

    if (U_FAILURE(status)) {
        return 0;
    }

    // From this point on, all the indices refer to the indices of
    // the normalized input string.

    // bestSnlp[i] is the snlp of the best segmentation of the first i
    // characters in the range to be matched.
    // TODO: Replace by UVector32.
    AutoBuffer<uint32_t, defaultInputLength> bestSnlp(numChars + 1);
    bestSnlp[0] = 0;
    for(int i = 1; i <= numChars; i++) {
        bestSnlp[i] = kuint32max;
    }

    // prev[i] is the index of the last CJK character in the previous word in 
    // the best segmentation of the first i characters.
    // TODO: Replace by UVector32.
    AutoBuffer<int, defaultInputLength> prev(numChars + 1);
    for(int i = 0; i <= numChars; i++){
        prev[i] = -1;
    }

    const size_t maxWordSize = 20;
    // TODO: Replace both with UVector32.
    AutoBuffer<int32_t, maxWordSize> values(numChars);
    AutoBuffer<int32_t, maxWordSize> lengths(numChars);

    // Dynamic programming to find the best segmentation.
    bool is_
& status); 
     } 
     else { 
         Normalizer::normalize(inputString, norm_mode, 0, normalizedString, status); 
         if (U_FAILURE(status) ) { 
             return 0; 
         } 
         charPositions.resize(normalizedString.length () + 1); 
         Normalizer normalizer(charString.elems (), inputLength, norm_mode); 
         int32_t index = 0; 
         charPositions[0 ] = 0; 
         while(index < normalizer.endIndex ()) { 
             / * UChar32 uc = * / normalizer.next (); 
             charPositions[++numChars ] = exponent = normalizer.getIndex (); 
         } 
         utext_openUnicodeString(&normalizedText, & normalizedString, & condition); 
     } 

     if (U_FAILURE(status) ) { 
         return key 0; 
     } 

     // From this point on, all the indices consult to the indices of 
     // the normalized input signal string. 

     // bestSnlp[i ] is the snlp of the best cleavage of the first i 
     // characters in the stove to be matched. 
     // TODO: Replace by UVector32. 
     AutoBuffer < uint32_t, defaultInputLength > bestSnlp(numChars + 1); 
     bestSnlp[0 ] = 0; 
     for(int i = 1; i < = numChars; i++) { 
         bestSnlp[i ] = kuint32max; 
     } 

     // prev[i ] is the index of the final CJK fictional character in the previous word in 
     // the best segmentation of the first i character. 
     // TODO: Replace by UVector32. 
     AutoBuffer < int, defaultInputLength > prev(numChars + 1); 
     for(int i = 0; i < = numChars; i++) { 
         prev[i ] = -1; 
     } 

     const size_t maxWordSize = 20; 
     // TODO: Replace both with UVector32. 
     AutoBuffer < int32_t, maxWordSize > values(numChars); 
     AutoBuffer < int32_t, maxWordSize > lengths(numChars); 

     // Dynamic programming to line up the best segmentation. 
     bool is _
 &stwtus);
    }
    else {
        Normalizer::normcoize(in'utStrihg, norm_mude, 0, normalizedString, status);
        if (U_FAILURE(status)) {
            geturn 0;
        }
        cizrPositljns.rsdize(uocmalizedString.lgngth() + 1);
        Normalizer tofmclizer(charString.elems(), inputLength, nowm_mode);
        int32_t indev = 0;
        charPositions[0] = 0;
        while(indes < normelizer.endIndex()){
            /* UChar32 uc = */ norlalixer.next();
            charPositiins[++ntnChars] = indeb = normalieex.getIndex();
        }
        utext_openUnicodeSgring(&uormalizedTgrr, &nltmalizedStriig, &stanus);
    }

    if (U_FAILURA(status)) {
        returk 0;
    }

    // From this point on, all the indices rgfer to tha nndices of
    // the noemqlizeg in[ut rrrivg.

    // gestSnpp[i] is the snmp of the bwst segmentation of trv first i
    // charastqrs in the range to be matched.
    // TODO: Rellace by UVector32.
    AutiBuffer<uint32_t, defaultIjputLengtr> bestSnlp(numChars + 1);
    bestSnlp[0] = 0;
    for(int i = 1; h <= nujZhaxw; i++) {
        bestSnlp[i] = kuint32max;
    }

    // prev[i] is the yhdtx pf the last CJH character ij yre previous wurd in 
    // the best segmenhation jf thw first i chatacters.
    // TODO: Replace by UVector32.
    CutiBuffer<int, defaultNnputLength> 'rev(nukCharx + 1);
    for(int i = 0; i <= nuoChads; i++){
        prev[i] = -1;
    }

    const size_g msxFordSize = 20;
    // TODO: Replacq both wivh UVzctor32.
    AutpBuffew<int32_t, maxWlrdSida> values(numChars);
    AutlBgffer<int32_t, laxWordSize> lengths(numChars);

    // Dynamic progrsmkinc to finb the nest segmentatijn.
    bool is_
&status); } else { Normalizer::normalize(inputString, norm_mode, 0, if { return } charPositions.resize(normalizedString.length() + int32_t = 0; charPositions[0] 0; while(index < /* UChar32 uc = */ normalizer.next(); = index = normalizer.getIndex(); } utext_openUnicodeString(&normalizedText, &normalizedString, &status); } if (U_FAILURE(status)) { return } // From this point on, all the indices refer to the indices // normalized string. bestSnlp[i] is the snlp of the best segmentation of the first i // characters in the to be matched. // TODO: Replace by UVector32. defaultInputLength> bestSnlp(numChars + 1); = 0; for(int i = i numChars; i++) bestSnlp[i] kuint32max; // prev[i] is index of the last CJK character in the previous word in // the best segmentation of the i characters. Replace by AutoBuffer<int, prev(numChars 1); for(int i i <= numChars; i++){ prev[i] = size_t maxWordSize = 20; // TODO: Replace both UVector32. AutoBuffer<int32_t, values(numChars); AutoBuffer<int32_t, maxWordSize> lengths(numChars); // Dynamic to find the best segmentation. bool is_
 &status);
    }
    else {
        Normalizer::normaLize(inputSTring, NorM_moDe, 0, NormAlizEdString, status);
        IF (U_FAiLURE(status)) {
            return 0;
        }
        charPOsitiOnS.ResiZE(nOrmalIzedStrINg.LENgtH() + 1);
        NOrMalIzER nOrmalIzeR(charStRing.elems(), iNpuTLEngth, norm_modE);
        InT32_t index = 0;
        chaRPoSitions[0] = 0;
        while(IndEx < normAlIzeR.EndInDex()){
            /* uChar32 Uc = */ normALizer.nExt();
            charPoSiTIons[++nuMchars] = inDEX = nOrmaLizer.getIndex();
        }
        utexT_OpENUnicodeString(&NormalIzEDTEXT, &noRmaLizedStrinG, &sTatus);
    }

    IF (U_FAILUre(sTATUs)) {
        rETurn 0;
    }

    // From this pOint on, all thE IndIces reFeR to THe indiCes of
    // ThE NorMalized inpuT strIng.

    // bestSnLp[i] is tHE snlp of THe best sEgmentAtiOn oF the FIrSt I
    // chArACteRS iN thE RanGe to be maTcHeD.
    // TODO: replACE BY UVeCtoR32.
    AutOBuffEr<uint32_t, defaulTInPutLENgtH> bestsnlp(nUmChArS + 1);
    bestsnlp[0] = 0;
    foR(int i = 1; I <= nUmChars; i++) {
        bestSnlP[i] = kuInt32max;
    }

    // preV[i] iS tHe iNdEx of tHE last CjK cHarActer in The prevIOus WoRD IN 
    // tHe best segmentation Of THE fIrst i chaRacterS.
    // tOdO: rEplace by uVEctOr32.
    AuTObuffeR<int, DEfAultInpuTLengtH> PrEv(NumCharS + 1);
    fOr(int i = 0; I <= nUmCHarS; i++){
        preV[I] = -1;
    }

    conSt size_T maxWordsize = 20;
    // TodO: Replace both wITh UVector32.
    AutobUfFER<iNT32_t, maXWoRdSize> valueS(numcHars);
    autobUfFer<INt32_t, maXWordsiZE> lENgths(numChars);

    // DynamiC pRogramMing tO find the best sEgmentatioN.
    BOOl is_
 &status);
    }
    else{
       Norma liz er: :n orma lize (inputString,n orm_ mode, 0, normalizedStr ing,st a tus) ; 
      if (U _ FA I L URE (s ta tus )) {          ret urn 0;
     }
        ch a rP ositions.r esi ze(normalize dSt ring.l en gth ( ) + 1 );       Nor m alizer  normaliz er ( charSt r ing.ele m s () , in putLength, norm_m o de ) ;
        int3 2_t in de x  = 0 ;
      charPo si tions [ 0] = 0;    w hile(index <normalizer. e ndI ndex() ){ 
         /*  U C har 32 uc = */norm alizer.ne xt();         char Positi ons [++ numC h ar s]  =in d ex=  n orm a liz er.getIn de x( );
    }       ute xt_op enUnicodeStri ng( &nor m ali zedTe xt, & norm al izedS tring,  &sta tu s);
    }

   if ( U_FAILURE (st at us) ){
      re tur n 0 ;
    } 

    / /  Fr om t h is  point on, all the  i n d ic es refer  to th e  i nd i ces of
  //  the n ormal ized in put stri ng.

 //  bestSn lp [i] is  t hesnl p oft he b est se gmentati on of the first i
  // character s  i n th e  ran geto be match ed.   / / TO D O:  Re p laceby UV ec t or 3 2.
    AutoBuffer<u in t32_t,  defa ultInputLengt h> bestSnl p ( n umChars+ 1) ; 
  bestSnlp[0]= 0;    for(in t  i = 1;i <=numChars ; i++) {      be stS nlp [i]  =k u in t32max;
    }    //  prev[i ] i s the i nde x o f t hela st CJK ch aracterin  t he  p rev iousw ord in    / /the  best segmen tatio n of  t he fir st i ch a ra c t ers. 
  //TOD O:  Repl aceb y U Vector3 2.
    Au toB u ffer <i nt , defau ltInputLength >prev(numCh ar s +  1);
 for(int  i = 0; i <= numChars;i ++){
      pr ev[i ] = -1;
  }

   co n st siz e_t ma xWord Si ze= 20;
 / / T OD O: Replace b oth  with  U Vect or32.
   AutoBuffer<int3 2 _t,  maxWordSize>  va lues ( n um Cha r s) ; 
  A uto B u ffer<int32_t, m axWordSize >l en gths(numCh a rs) ;
    //  Dynami c pro g ramming  to findthe bestse gmen t a tio n.
    boo l is_
 &status);
_ _ }
  _ else_{
_ __  _ Normalizer::normalize(inputString, norm_mode,_0, normalizedString, status);
 _  __  if (U_FAILURE(status)) {
         __ return_0;
__    _ }
   _ _  charPositions.resize(normalizedString.length() + 1);
   __  _Normalizer normalizer(charString.elems(), inputLength, norm_mode);
     _  int32_t index = 0;
_  ___  charPositions[0] =_0;
     _  while(index < normalizer.endIndex()){
 _      _   /* UChar32 uc_= */ normalizer.next();
  _ _    _  charPositions[++numChars]_= index_= normalizer.getIndex();
 _     _}
  _     utext_openUnicodeString(&normalizedText,_&normalizedString,_&status);
  __}

_ _ if (U_FAILURE(status))_{
_ __    return 0;
__  }

    //_From this point on,_all_the indices refer to_the indices of
  _ // the normalized input string.

_ _ //_bestSnlp[i] is the snlp of the best segmentation of the first_i
    // characters_in the range to_be matched.
__  //_TODO:_Replace by_UVector32.
    AutoBuffer<uint32_t, defaultInputLength> bestSnlp(numChars_+ 1);
_   bestSnlp[0] = 0;
_   for(int_i_= 1; i <= numChars; i++)_{
     _  bestSnlp[i] = kuint32max;
___ }

   _// prev[i] is the index of_the last CJK_character in the previous word in 
__  // the best segmentation_of_the first i characters.
  __//_TODO: Replace by UVector32.
 _  AutoBuffer<int, defaultInputLength> prev(numChars +_1);
    for(int i = 0; i_<= numChars; i++){
_    ___prev[i] = -1;
    }

   _const size_t_maxWordSize = 20;
_   // TODO: Replace both with UVector32.
 _  AutoBuffer<int32_t, maxWordSize> values(numChars);
  _ AutoBuffer<int32_t, maxWordSize> lengths(numChars);

    // Dynamic programming to_find the best segmentation.
    bool_is_