I apologise for the confusion caused by my earlier response.
The automatic template deduction works in the first example because the type is explicitly specified - `key1` is declared to be of type `std::string`.
The second example fails because the type of the string literal `"apple"` is assumed to be `const char*` by the compiler, which conflicts with `map2`'s type (`std::string`).

The error can be fixed by either explicitly specifying the template's arguments:
```
int key2 = getkey<int, std::string>(map2, "apple");
```
Or by using the std::string literal suffix:
```
using namespace std::string_literals;
int key2 = getkey(map2, "apple"s);
```
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence