-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathtest.cpp
More file actions
53 lines (39 loc) · 1.04 KB
/
test.cpp
File metadata and controls
53 lines (39 loc) · 1.04 KB
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
52
53
#include <iostream>
#include <string.h>
using namespace std;
int comp(string s1,string s2){
int n1=s1.length(),n2=s2.length(),p=0;
cout<<s2[3];
if(n2<n1){
int k = 0;
for(int i = 0;i<=n2;i++){
cout<<"p="<<p<<" k= "<<k;
cout<<" i="<<i;
if(s2[i]==s1[k]){
k++;
}else{
if(i==n2-1){
p=1;
cout<<"end loop";
}
k++;cout<<" 4t"<<p<<k;
}
}
return p;cout<<" 5t"<<p;
}
}
int main() {
string str1,str2;
cin>>str1;cin>>str2;
int n1=str1.length(),n2=str2.length(),p=0,arr[n1];
string arr1[n1],arr2[n2];
for(int i = 0;i<n1;i++){
arr1[i]=str1[i];
}
for(int i = 0;i<n2;i++){
arr2[i]=str2[i];
}
int a = comp(str1,str2);
cout<<"a";
cout<<a;
}