Smallest element in an array that is repeated exactly ‘k’ times
Interface


There's no point in limiting your function inputs to a vector. You can take two input iterators instead. It'll make your function more flexible and more "standard library-like".
One function should do one focused thing. Your function finds such an element  and  prints it as the same time. These concerns are unrelated. You can return std::optional&lt;T&gt; instead to represent either such an element or its absence. Note: it works for C++17 only. You can use boost::optional or return a smart pointer if it's not available. 


Modern C++


There's no need for things like this anymore: 

typename std::map&lt;T, int&gt;::iterator itr;
for(itr = count.begin(); itr != count.end(); itr++)


for (const auto&amp; kv : count) is much better, isn't it?
You can also use initialization list to create a vector with the elements you need: std::vector&lt;char&gt; v({'r', 't',..., 's'})


Performance


for (T x : vec) creates an unnecessary copy. Use for (const T&amp; x : vec) or for (const auto&amp; T : vec) instead.
You can also use std::unordered_map to do the counting and then choose the smallest element (it's more efficient because one can find the minimum in O(n). It's "easier" than sorting the input). One caveat: you need a hash function for T in this case. You can pass it as another template parameter, defaulted to std::hash.