this is the loop im executing
for(int i=0;i<str.length;i++){
    if (str[i]==strFind) {
        str[i]=strReplace;
        count++;
    }
}
The problem is that if the last word of the sentence has a period in some test cases and it doesn't have a period in some.And if i replace the word in the given manner. I cannot retain the period. Is there a simpler solution for this? Also, can replace all take a sting variable(strReplace-user input)?
 
     
     
     
    