Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main ()
- {
- char f;
- char g;
- int c=0;
- string str;
- cout << "Vvedit' ryadok sliv:"<< endl;
- getline(cin,str);
- for (int i=0; i<str.size(); i++)
- {
- if (str[i]>=97 && str[i]<=122)
- {
- str[i]-=32;
- }
- }
- for (int i=0; i<str.size(); i++)
- {
- for (int j=0; j<str.size()-1; j++)
- {
- if (str[j] > str[j+1])
- {
- int t = str[j];
- str[j]=str[j+1];
- str[j+1]=t;
- }
- }
- }
- for(int i=0;i<str.size();i++)
- {
- if (str[i]>=65 && str[i]<=90)
- {
- f = str[i];
- g=str[i+1];
- if(f!=g)
- {
- for(int v=0;v<str.size();v++)
- {
- if(str[v]==f)
- {
- c++;
- }
- }
- cout<<f<<" = "<<c<<endl;
- c=0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement