Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <set>
- #include <map>
- using namespace std;
- void wypisz_samogloski(map<char, int> mapa)
- {
- string samogloski = "aeiou";
- for (auto& para : mapa)
- {
- if (samogloski.find(para.first) != string::npos)
- {
- cout << para.second << "\n";
- }
- }
- }
- void wprowadz_do_mapy(set<char> zbior)
- {
- map<char, int> mapa;
- for (auto& litera : zbior)
- {
- char lit = tolower(litera);
- int poz = lit - 'a' + 1;
- mapa.insert(make_pair(lit, poz));
- }
- wypisz_samogloski(mapa);
- }
- string usun_powtorzenia(string str)
- {
- set<char> zbior;
- string nowy = "";
- for (int i = 0; i < str.size(); i++)
- {
- if (zbior.find(str[i]) == zbior.end())
- {
- nowy += str[i];
- zbior.insert(str[i]);
- }
- }
- wprowadz_do_mapy(zbior);
- return nowy;
- }
- int main()
- {
- string wejscie;
- cout << "Wpisz słowo: \n";
- cin >> wejscie;
- cout << usun_powtorzenia(wejscie);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement