fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main(){
  6. ios_base::sync_with_stdio(0);
  7. cin.tie(0);
  8. cout.tie(0);
  9.  
  10. int k;
  11. string akt_slowo;
  12. cin>>k;
  13. vector <string> slowo;
  14. while(cin>>akt_slowo){
  15. slowo.push_back(akt_slowo);}
  16. cout<<slowo[slowo.size() - k];
  17. }
Success #stdin #stdout 0.01s 5284KB
stdin
3
balagan
gapa
kapusniak
gluptasek
stdout
gapa