
BIRTHDAY GIFT
C++
// codewindow.in // Birthday gift // code in C++ #include<bits/stdc++.h> #define m 10000000007 using namespace std; int substring_k(string str, int length, int k){ int count = 0; int array[26]; for (int i = 0; i < length; i++){ int temp = 0; memset(array, 0, sizeof(array)); for (int j = i; j < length; j++){ if(array[str[j]- 'a'] == 0){ temp++; } array[str[j] - 'a']++; if (temp == k){ count++; } if(temp > k){ break; } } } return count; } int main(){ string str; cin>>str; int length = str.length(); int k; cin>>k; cout<<substring_k(str, length, k)%m; return 0; } //end
Follow us
Also Checkout
- Dunzo Off-Campusing Drive | Data Engineer | codewindow.in
- Verbal Ability Questions Solved | Synonyms Antonyms – codewindow.in
- Verbal Ability Questions Solved | Statement Correction – codewindow.in
- Verbal Ability Questions Solved | Spotting Error – codewindow.in
- Verbal Ability Questions Solved | Speech and Tenses – codewindow.in
- Try
- Verbal Ability Questions Solved | Sentence Arrangement – codewindow.in
- Verbal Ability Questions Solved | Prepositions – codewindow.in
- Verbal Ability Questions Solved | Grammar – codewindow.in
- Verbal Ability Questions Solved | Articles – codewindow.in
- Zoho Off Campus Drive | Product Marketing Associate / Specialist | codewindow.in
- BerryWorks Off Campus Recruitment Drive – Software Engineer – Codewindow.in
- Microsoft Off Campus Hiring Drive – Technical Support – Codewindow.in
- Infosys Pseudocede & Puzzle Solved – codewindow.in
- Infosys Verbal Questions Solved – codewindow.in
- Amazon Off Campus Drive | Trainee | codewindow.in
- Hawkins Off Campus Drive | Management trainees | codewindow.in
- Infosys Mathematical Questions Solved – codewindow.in
- Paypal Off Campus Recruitment Drive – Software Engineer – Codewindow.in
- IBM Off Campus Hiring Drive – Associate Systems Engineer – Codewindow.in
- Infosys Off Campus Hiring Drive – SP and DSE – Codewindow.in
- VIRTUSA Recruitment 2022 | Associate Engineer | codewindow.in
- Infosys Logical Questions solved – codewindow.in
- Google Off Campus Hiring Drive – IT Support Engineer – Codewindow.in
- Capgemini Pseudocode Solved | Set 4 – codewindow.in
- Capgemini Pseudocode Solved | Set 3 – codewindow.in
- Capgemini Pseudocode Solved | Set 2 – codewindow.in
- JECA 2022 Question Paper – 90+ Sample Questions Exposed – codewindow.in
- Capgemini Pseudocode Solved | Set 1 – codewindow.in
- Verizon Off Campusing | Software Developer | codewindow.in
- TCS Recruitment Off-Campusing | Service Desk Analyst | codwindow.in
- Amdocs Off-Campusing | Devops Engineer | codewindow.in
- Wipro Paper Solved | Technical Set 2 – codewindow.in
- Wipro Paper Solve | Technical Set 1 – codewindow.in
- Mindtree Off-Campusing | Software Engineer | codewindow.in
- Mastercard Off Campus Hiring Drive – Jr Software Engineer – Codewindow.in
- Wipro Paper Solve | Aptitude Set 3 – codewindow.in
- MindTree Interview Round Experience – 30+ Questions EXPOSED – codewindow.in
- Wipro Paper Solve | Aptitude Set 2 – codewindow.in
- Wipro Paper Solve | Aptitude Set 1 – codewindow.in
- Verbal Ability | Set 4 | Infosys – codewindow.in
- Wipro Off-Campusing | Project Engineer | codewindow.in
- TCS Digital Coding Questions – 3 Problems with Solution – codewindow.in
- Capgemini Placement Questions 2022 – 20 Frequent Questions Solved – codewindow.in
- Accenture Paper on 10th December – All Questions Solved – codewindow.in
- Flipkart GriD 4.0 | Software Development Challenge 2022 | codewindow.in
- Axis Bank Off-Campusing | Branch Relationship Officer | codewindow.in
- Mundrisoft Off-Campusing | Trainee DevOps Engineer | codewindow.in
- Verbal Ability | Set 3 | Infosys – codewindow.in
- Verbal Ability | Set 2 | Infosys – codewindow.in