#include <iostream>
#include <vector>
#include <string>

int main() {
    std::string a = "adarsh";
    std::vector<int> frq(128, 0);

    for(char i=0; a[i]!='\0'; i++) {
        frq[a[i]]++;
    }

    for(int i=0; i<128; i++){
        if(frq[i] == 1) {
            std::cout<<static_cast<char>(i)<<std::endl;
        }
        if(frq[i] == 2){
            std::cout<<static_cast<char>(i)<<std::endl;
        }
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: