例如:我想要将“leetcode”存放到哈希映射里面,那么存储顺序应该是 l e t c o d;
但是,输出的顺序是 d o l e t c

#include <iostream>
#include <unordered_map>

using namespace std;

int main()
{
   
    unordered_map<char, int> HashMap1;
    unordered_map<char, int> HashMap2;
    string s = "leetcode";
    for (int i = 0; i < s.size(); ++i)
    {
   
        HashMap1[s[i]] = i;
        if (HashMap2.count(s[i]) == 0)
        {
   
            HashMap2[s[i]] = i;
        }
    }
    for(auto j:HashMap1){
   
        cout<< j.first<<" ";
    }
    cout<<endl;
    for(auto j:HashMap2){
   
        cout<< j.first<<" ";
    }
    return 0;
}