Waliul

Solution of 1

Mar 16th, 2021 (edited)
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int i, j, k, sz;
  7.     string str;
  8.     cout<<"Enter a string : ";
  9.     cin>>str;
  10.     sz = str.size();
  11.     for(i = 0; i < sz; i++)
  12.     {
  13.         if(str[i] >= 'a' && str[i] <= 'z')
  14.         {
  15.             char ch;
  16.             ch = str[i] - 'a' + 'A';
  17.             str[i] = ch;
  18.         }
  19.     }
  20.     sort(str.begin(), str.end());
  21.     cout<<"The expected string : "<<str<<endl;
  22. }
  23.  
Add Comment
Please, Sign In to add comment