#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main(int argc, char **argv)
{
char array[7] = {'A', 'A', 'B', 'B', 'A', 'G', 'A'};
map<char, int> letter_count;
for(int i = 0; i < 7; ++i)
{
++letter_count[array[i]];
}
map<char, int>::iterator iter;
int repeat_letter_count = 0;
for(iter = letter_count.begin(); iter != letter_count.end(); ++iter)
{
repeat_letter_count += (*iter).second - 1;
}
cout << "Number of repeated letters: " << repeat_letter_count << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKiphcmd2KQp7CiAgICBjaGFyIGFycmF5WzddID0geydBJywgJ0EnLCAnQicsICdCJywgJ0EnLCAnRycsICdBJ307IAogICAgbWFwPGNoYXIsIGludD4gbGV0dGVyX2NvdW50OwogICAgZm9yKGludCBpID0gMDsgaSA8IDc7ICsraSkKICAgIHsKICAgICAgICArK2xldHRlcl9jb3VudFthcnJheVtpXV07CiAgICB9CiAgICBtYXA8Y2hhciwgaW50Pjo6aXRlcmF0b3IgaXRlcjsKICAgIGludCByZXBlYXRfbGV0dGVyX2NvdW50ID0gMDsKICAgIGZvcihpdGVyID0gbGV0dGVyX2NvdW50LmJlZ2luKCk7IGl0ZXIgIT0gbGV0dGVyX2NvdW50LmVuZCgpOyArK2l0ZXIpCiAgICB7CiAgICAgICAgcmVwZWF0X2xldHRlcl9jb3VudCArPSAoKml0ZXIpLnNlY29uZCAtIDE7CiAgICB9CiAgICBjb3V0IDw8ICJOdW1iZXIgb2YgcmVwZWF0ZWQgbGV0dGVyczogIiA8PCByZXBlYXRfbGV0dGVyX2NvdW50IDw8IGVuZGw7CiAgICAKICAgIHJldHVybiAwOwp9