title: Text comparison algorithm or program?
body: <p>I am having Two paragraphs which are having sentences, I wanted to compare both the paragraphs and want to show the differences at UI.</p>
  
  <p>Below are the possible use-cases, Which I can think about. Any help in algorithm or code will be appreciable.</p>
  
  <p><a href="https://i.stack.imgur.com/6yqWz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6yqWz.png" alt="enter image description here"></a></p>
  
  <p>Case 1: Word Deleted from str2</p>
  
  <pre><code>String str1 = "Hello I am new How are you";
  String str2 = "How are you Hello";
  
  output :
  str1 = "&lt;del&gt;Hello I am new&lt;/del&gt; How are you";
  str2 = "How are you &lt;add&gt;Hello&lt;/add&gt;"
  </code></pre>
  
  <p>Case 2:  Word added to str2</p>
  
  <pre><code>String str1 = "Hello How are you what about you";
  String str2 = "How are you I am fine what about you";
  
  output :
  str1 = "&lt;del&gt;Hello&lt;/del&gt; How are you what about you";
  str2 = "How are you &lt;add&gt;I am fine&lt;/add&gt; what about you"
  </code></pre>
  
  <p>Case 3: Words are equal</p>
  
  <pre><code>    String str1 = "Hello How are you";
      String str2 = "Hello How rea you";
  
      output :
      str1 = "Hello How &lt;missmatch&gt;are&lt;/missmatch&gt; you";
      str2 = "Hello How &lt;missmatch&gt;rea&lt;/missmatch&gt; you"
  </code></pre>