Hello All,

here is the code I have came out with, but it doesn't work as it should.
I have tried to get it working correctly but now I have ran out of ideas.


Code:
public static String lastTranslate(String aString)
   {
      String[] choppedString = new String[aString.length()];
      String delimiter = " ";
      String result = new String();
      choppedString = aString.split(delimiter);
      
      
      for (int i = 0; i<choppedString.length; i++)
         {
            result = result + firstTranslate(choppedString[i]);
            if (result.contains(choppedString[i]))
            {
               result = result + secondTranslate(choppedString[i]);
            }
            
         }
            
         

return result;
         
   }
I have checked firstTranslate and secondTranslate and they seem to work ok.
I have problem to get lastTranslate to work. for example if aString will be "2 y" the result I'm getting is 2towhyy instead of towhy. when aString is "2 idk" it will produce 2toI don't know".
Don't know why but when output string for firstTranslate is longer than 3 characters it is produced correctly.

Please can someone push me in the right direction.
Regards
Intruz