"000" is a string commonly found in weak passwords. Count the number of occurrences of "000" in keyWord and remove all instances of "000" from keyword. Ex: If the input is 000kgnklv$L#x000, then the output is: Number of violations: 2 Remaining string: kgnklv$L#x Note: • string.find(item) returns the index of the first occurrence of item in string. If no occurrence is found, then the function returns string:npos. • string.replace(indx, num, subStr) replaces characters at indices indx to indx+num-1 with a copy of subStr. 3 using namespace std; 4 5 int main() { 6 7 8 9 10 11 12 13 14 15 16 17 18 19 string keyword; int count; int index; cin >> keyword; count = 0; index = 0; /* Your code goes here */ cout << "Number of violations: " << count << endl; cout << "Remaining string: " << keyword << endl; return 0; D 3
"000" is a string commonly found in weak passwords. Count the number of occurrences of "000" in keyWord and remove all instances of "000" from keyword. Ex: If the input is 000kgnklv$L#x000, then the output is: Number of violations: 2 Remaining string: kgnklv$L#x Note: • string.find(item) returns the index of the first occurrence of item in string. If no occurrence is found, then the function returns string:npos. • string.replace(indx, num, subStr) replaces characters at indices indx to indx+num-1 with a copy of subStr. 3 using namespace std; 4 5 int main() { 6 7 8 9 10 11 12 13 14 15 16 17 18 19 string keyword; int count; int index; cin >> keyword; count = 0; index = 0; /* Your code goes here */ cout << "Number of violations: " << count << endl; cout << "Remaining string: " << keyword << endl; return 0; D 3
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question

Transcribed Image Text:"000" is a string commonly found in weak passwords. Count the number of occurrences of "000" in keyWord and remove all
instances of "000" from keyword.
Ex: If the input is 000kgnklv$L#x000, then the output is:
Number of violations: 2
Remaining string: kgnklv$L#X
Note:
string.find(item) returns the index of the first occurrence of item in string. If no occurrence is found, then the function
returns string:npos.
• string.replace(indx, num, subStr) replaces characters at indices indx to indx+num-1 with a copy of subStr.
3 using namespace std;
4
5 int main() {
6
7
8
9
10
11 count = 0;
218H15 16 18 19
string keyword;
int count;
int index;
12 index = 0;
13
cin >> keyword;
17
14 /* Your code goes here */
cout << "Number of violations: " << count << endl;
cout << "Remaining string: " << keyword << endl;
return 0;
D
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY