Converting one string to other using append and delete last operations in C++

In this tutorial, we will be discussing a program to convert one string to other using append and delete last operations.

For this we will be provided with two strings. Our task is to calculate whether the first string can be converted into the second one by performing k operations of append and delete last element.

Example

#include 
using namespace std;
//checking if conversion between strings is possible
bool if_convert(string str1, string str2,
int k){
   if ((str1.length() + str2.length()) 

Output

No
Updated on: 2020-01-29T07:49:47+05:30

164 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements