title: Minimum manipulations to type the string
body: <p>You have given a string called T, and you have to type it in the minimum manipulations.
  There are 3 manipulations:</p>
  <ul>
  <li><strong>Insert</strong> one character to the end of the string (we called S)</li>
  <li><strong>Copy</strong> a substring in string S, the copied string will be stored in a clipboard
  and if you copy another substring, this substring will be delete of the clipboard</li>
  <li><strong>Paste</strong> the copied-substring to the end of S</li>
  </ul>
  <p><strong>Example 1:</strong>
  T=abcabab
  We can use 6 manipulations:</p>
  <ol>
  <li>Insert 'a' (S=&quot;a&quot;)</li>
  <li>Insert 'b' (S=&quot;ab&quot;)</li>
  <li>Insert 'c' (S=&quot;abc&quot;)</li>
  <li>Copy &quot;ab&quot; into clipboard (S=&quot;abc&quot;; clipboard: &quot;ab&quot;)</li>
  <li>Paste &quot;ab&quot; (S=&quot;abcab&quot;)</li>
  <li>Paste &quot;ab&quot; (S=&quot;abcabab&quot;)</li>
  </ol>
  <p><strong>Example 2:</strong>
  T =  aaaaaaaaaaa
  We can use 7 manipulations:</p>
  <ol>
  <li>Insert 'a' (S=&quot;a&quot;)</li>
  <li>Insert 'a' (S=&quot;aa&quot;)</li>
  <li>Insert 'a' (S=&quot;aaa&quot;)</li>
  <li>Copy &quot;aaa&quot; into clipboard (S=&quot;aaa&quot;; clipboard: &quot;aaa&quot;)</li>
  <li>Paste &quot;aaa&quot; (S=&quot;aaaaaa&quot;)</li>
  <li>Copy &quot;aaaaa&quot; into clipboard (S=&quot;aaaaaa&quot;; clipboard: &quot;aaaaa&quot;)</li>
  <li>Paste &quot;aaaaa&quot; (S=&quot;aaaaaaaaaaa&quot;)</li>
  </ol>