Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- using namespace std;
- map <string, int> mapa;
- int generarId(string s)
- {
- if(mapa[s] == 0)
- mapa[s] = mapa.size();
- return mapa[s];
- }
- int main()
- {
- int cant;
- cin >> cant;
- for(int i=0; i<cant; i++)
- {
- string s;
- cin >> s;
- cout << generarId(s) << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement