Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- void zliczaczLiter(string tex)
- {
- size_t pos;
- int ilosc = 0;
- char l = 97;
- do
- {
- do
- {
- if((pos = tex.find(l, pos+1)) != string::npos) ilosc+=1;
- else
- {
- if(ilosc == 0) break; // BEZ TEGO WARUNKU WYPISUJE NORMALNIE WSZYSTKIE LITERY ORAZ ICH ILOSC, A Z NIM NIE DZIALA POPRAWNIE
- cout << l << " " << ilosc << endl;
- l+=1;
- ilosc = 0;
- }
- }while(pos != string::npos);
- }while(l <= 122);
- }
- int main()
- {
- string tekst;
- getline(cin, tekst);
- zliczaczLiter(tekst);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement