Files
PAT/html/t1020.html
T

30 lines
963 B
HTML

<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<h1>1020. Delete At Most Two Characters (35)</h1>
<div id="problemContent">
<p>Given a string which contains only lower case English letters, how many different strings you can get after deleting <b>AT MOST TWO</b> characters in it?
</p>
<p><b>
Input Specification:
</b></p>
<p>Each input file contains one test case, which gives the string whose length is in [3, 10<sup>6</sup>].
</p>
<p><b>
Output Specification:
</b></p>
<p>Print in a line the number of different strings you can get after deleting at most 2 characters.
</p>
<b>Sample Input:</b><pre>
ababcc
</pre>
<b>Sample Output:</b><pre>
15
</pre>
<p>
Hint:</p>
<p>
Deleting 0 character gets "ababcc".<br/>
Deleting 1 character gets "babcc", "aabcc", "abbcc", "abacc" and "ababc". <br/>
Deleting 2 character gets "abcc", "bbcc", "bacc", "babc", "aacc", "aabc", "abbc", "abac" and "abab".<br/>
</p>
</div>