how to sort a string alphabetically in c++

#include <iostream>
#include <algorithm>
using namespace std;

int main() {
   string str = "hello";
   sort(str.begin(), str.end());
   cout << str;
   return 0;
}