in my code to solve the problem INNA AND DIMA (http://codeforces.com/problemset/problem/374/C) from codeforces, i need to link two chars in a given order.i tried using a map of chars but it gives error,below is my code and the error it gives,can somebody please point out my mistake, and the right way to do it.
unordered_map<char, char> next;// = {{'D','I'},{'I','M'},{'M','A'},{'A','D'}}; this works
next['D'] = 'I'; //but writing in map in this way produces the ERROR :
next['I'] = 'M'; //reference to 'next' is ambiguous, 'next' does'nt name a type
next['M'] = 'A';
next['A'] = 'D';
and further in the prog when try to check if the contents of the map are correctly stored,no matter what way i choose from above two ways to write again i get errors:
for(auto it : next) //ERROR:reference to 'next' is ambiguous
cout<<next[it.first]<<' '; //ERROR:reference to 'next' is ambiguous