Dsa Lab7
Dsa Lab7
Class: 02-132212-010
Question:
1) Find the length of the string (the string should be inserted by the user).
2) Determine the substring (from the inserted string) by taking the starting
index from the user and number of characters for the substring.
3) Take 2 strings as an input and concatenate them.
4) Delete the string (taken from the user) from the array of strings that was
inserted by the user.
5) Implement the Brute Force Search Algorithm.
CODE:
#include <iostream>
int main() {
string str;
cout << "Length of the string: " << str.length() << endl;
int start;
int numChars;
int n;
cin >> n;
string arr[n];
string toDelete;
if (arr[i] == toDelete) {
arr[j] = arr[j+1];
n--;
break;
}
}
cout << "Array after deleting " << toDelete << ": ";
string searchString;
string text;
if (text[i+j] != searchString[j]) {
match = false;
break;
if (match) {
found = true;
}
}
if (!found) {
return 0;
}
OUTPUT: