Posted on December 6, 2021 Description Submission class Solution { public: string truncateSentence(string s, int k) { auto it = s.begin(); for(int i = 0; i < k; ++i) { it = find(it+1, s.end(), ' '); } return s.substr(0, it - s.begin()); } }; By Bill0412 Easy LeetCode