Script that replace each repeated letter in a string with one letter
<p>I have a script which takes a word from input file and outputs customizated word in output file.</p>

<p>For example, in input file I have word <code>ccccccaaaaaannnnndlllllleeeee</code>and I need to edit the word it to look like candle and output in other file. So could you please give me a example of it?</p>

<p>So far I have: </p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
using namespace std;
int main(){
    string vards;
    std::ifstream input_file("virkne3.in");
    input_file &gt;&gt; vards;
    std::ofstream output_file("virkne3.out");
    output_file &lt;&lt; vards.erase(std::unique(vards.begin(), vards.end()), vards.end());
    cin.clear();
    cin.ignore(255, '\n');
    cin.get();
    return 0;
}
</code></pre>
