File tree 1 file changed +7
-41
lines changed
1 file changed +7
-41
lines changed Original file line number Diff line number Diff line change @@ -18,48 +18,14 @@ Sample Output:
18
18
7TI
19
19
20
20
#include < iostream>
21
+ #include < cctype>
21
22
using namespace std ;
22
23
int main () {
23
- string a;
24
- cin >> a;
25
- int lena = a.length ();
26
- string b;
27
- cin >> b;
28
- int lenb = b.length ();
29
- char c[100 ];
30
- int i = 0 , j = 0 , t = 0 ;
31
-
32
- while (j <= lenb - 1 ) {
33
- if (b[j] != a[i]) {
34
- c[t++] = a[i];
35
- i++;
36
- } else {
37
- i++;
38
- j++;
39
- }
40
- }
41
-
42
- if (i != lena) {
43
- for (int k = i; k <= lena - 1 ; k++) {
44
- c[t++] = a[k];
45
- }
46
- }
47
-
48
- for (int k = 0 ; k < t; k++) { if (c[k] >= ' a' && c[k] <= ' z' )
49
- c[k] = c[k] - 32 ;
50
- }
51
-
52
- for (int k = 0 ; k < t; k++) {
53
- for (int m = 0 ; m < k; m++) {
54
- if (c[m] == c[k]) {
55
- c[k] = ' #' ;
56
- }
57
- }
58
- }
59
-
60
- for (int k = 0 ; k < t; k++) {
61
- if (c[k] != ' #' )
62
- cout << c[k];
63
- }
24
+ string s1, s2, ans;
25
+ cin >> s1 >> s2;
26
+ for (int i = 0 ; i < s1.length (); i++)
27
+ if (s2.find (s1[i]) == string::npos && ans.find (toupper (s1[i])) == string::npos)
28
+ ans += toupper (s1[i]);
29
+ cout << ans;
64
30
return 0 ;
65
31
}
You can’t perform that action at this time.
0 commit comments