#define _CRT_SECURE_NO_WARNINGS #define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING #include using namespace std; const int N = 5000050; char s[N]; deque pos[26]; int main() { const auto sz = acos(-1); int k; scanf("%s%d", s, &k); int n = strlen(s); for (int i = 0; i < n; i++) pos[s[i] - 'a'].push_back(i); int lmost = 0, lsec = 0; while (pos[lmost].empty()) lmost++; lsec = lmost + 1; while (lsec < 26 && pos[lsec].empty()) lsec++; for (int i = 0; i < n; i++) { while (pos[lmost].size() && pos[lmost].front() < i) pos[lmost].pop_front(); if (pos[lmost].empty()) { while (pos[lmost].empty()) lmost++; lsec = lmost + 1; while (lsec < 26 && pos[lsec].empty()) lsec++; } } return 0; }