File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ // ** -- code of "Studying alphabet " --Code chef -- **
3
+ #include < iostream>
4
+ using namespace std ;
5
+ int main ()
6
+ {
7
+ string s; cin>>s;
8
+ int a[26 ]={0 }; // we put the value 0 in all the blocks
9
+ int len = (int )s.size (); // length of string
10
+ for (int i=0 ;i<len;i++)
11
+ {
12
+ char x = s[i]; // lets suppose x ='c'
13
+ int p = int (x); // p =99
14
+ p = p-97 ; // index of that character // p =2
15
+ a[p]=1 ;
16
+ }
17
+ int n; cin>>n;
18
+ for (int i=0 ;i<n;i++)
19
+ {
20
+ int count=0 ; // no. of charcter that not present in string s
21
+ string k; cin>>k; // k--> words
22
+ for (int j=0 ;j<k.size ();j++)
23
+ {
24
+ char z = k[j]; // let's supose z= 'f'
25
+ int h = int (z); // h=102
26
+ h = h-97 ; // h=5
27
+ if (a[h]==0 )
28
+ count++;
29
+ else
30
+ count=count;
31
+ }
32
+ if (count>0 )
33
+ cout<<" No" <<endl;
34
+ else
35
+ cout<<" Yes" <<endl;
36
+
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments