Wrong anti-spam code

Formulation

Create a generic function kthLargest that accepts one argument of type set. The function should return the \(k\)-th largest element of the set. You are allowed to assume that the function will only be applied to sets that have at least \(k\) elements.

You should only write the code that replaces the text // ??? //.

#include<iostream>
#include<set>
template<typename T>
T kthLargest(const std::set<T> & a, long k){
  // ??? //
}
int main(){
   std::set<long> numbers; std::set<std::string> words;
   long n; std::string w;
   std::cin>>n;
   while(n>0){numbers.insert(n);std::cin>>n;}
   std::cin>>w;
   while(w!="end"){words.insert(w);std::cin>>w;}
   long k; std::cin>>k;
   std::cout<<kthLargest<long>(numbers,k)<<" "<<kthLargest<std::string>(words,k)<<"\n";
   return 0;
}

Your submission


Picture
Prove that you are not a robot.