Submission #3413992


Source Code Expand

#include <iostream>
#include <vector>
#include <string>
#include <complex>
#include <math.h>

using namespace std;

int main(){
    string s;
    getline(cin,s);
    
    int k;
    cin >> k;
    
    vector<string> strs;
    
    for (int i=1;i<=k;i++)
        for (int j=0;j<s.size()-k+1;j++) strs.push_back(s.substr(j,k));
    
    sort(strs.begin(),strs.end());
    unique(strs.begin(),strs.end());
    
    cout << strs[k-1] << '\n';
    return 0;
}

Submission Info

Submission Time
Task C - K-th Substring
User rha2thm
Language C++14 (GCC 5.4.1)
Score 0
Code Size 481 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:21:33: error: ‘sort’ was not declared in this scope
     sort(strs.begin(),strs.end());
                                 ^
./Main.cpp:22:35: error: ‘unique’ was not declared in this scope
     unique(strs.begin(),strs.end());
                                   ^