Untitled
unknown
plain_text
2 years ago
509 B
3
Indexable
Never
#include <iostream> using namespace std; void task(const string& ip) { int freq[126] = {0}; string unique; for (const auto& each_char : ip) { if (freq[each_char] == 0) unique.push_back(each_char); ++freq[each_char]; } for(const auto& each_unique_char : unique){ char temp = (char)(freq[each_unique_char] + ('A' - 1)); cout << temp; } } int main() { string input = "abbbcccddaab"; task(input); }