We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1946b4f commit 87c42ecCopy full SHA for 87c42ec
String/Substring/check_substring.cpp
@@ -0,0 +1,27 @@
1
+#include <iostream>
2
+#include <string>
3
+
4
+using namespace std;
5
6
+bool isSubstr(string a, string b){
7
+ bool is =0;
8
+ if(b.find(a) != std::string::npos){
9
+ is =1;
10
+ }
11
+ return is;
12
+}
13
+//check if string a is substring of b
14
+int main(){
15
+ string a,b;
16
+ cin >> a;
17
+ cin >> b;
18
19
+ if(isSubstr(a,b)){
20
+ cout << "yes"<<endl;
21
+ }else{
22
+ cout << "no"<<endl;
23
24
25
26
+ return 0;
27
0 commit comments