-
Notifications
You must be signed in to change notification settings - Fork 0
/
day6Problem2.cpp
51 lines (45 loc) · 1.5 KB
/
day6Problem2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
Day 6 - Question 2 :
You are given two strings a and b. You are going to print the string a character
by character, from the first character to the last one.
When printing a character, instead of pressing the button corresponding to it,
you can press the "Backspace" button. It deletes the last character you have
printed among those that aren't deleted yet (or does nothing if there are no
characters in the current string). For example, if string a is "abcbd" and you
press Backspace instead of typing the first and the fourth characters, you will
get the string "bd" (the first press of Backspace deletes no character, and the s
econd press deletes the character 'c'). Another example, if string a is "abcaa" and
you press Backspace instead of the last two letters, then the resulting text is "a".
Your task is to determine whether you can obtain the string b, if you print the s
tring a and press "Backspace" instead of printing several (maybe zero) characters of a.
Example
Input:
4
ababa
ba
ababa
bb
aaa
aaaa
aababa
ababa
Output:
YES
NO
NO
YES
*/
#include <iostream>
using namespace std;
int main(){
string a;
string b;
cin >>a;
cin >>b;
int alen = a.length();
int blen = b.length();
if(alen >= blen)
for(int i=0;i<alen - blen +1;i++){
cout<<"Nahi ala ";
}
}