-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBroken_Keyboard.cpp
64 lines (61 loc) · 1.19 KB
/
Broken_Keyboard.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
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <iostream>
#include <string>
int main()
{
std::string s1, s2;
std::cin >> s1 >> s2;
char c[100];
int count = 0;
int i = 0, j = 0;
while (j < s2.size())
{
if (s1[i] == s2[j])
{
i++;
j++;
}
else
{
int flag = 0;
if (s1[i] >= 'a' && s1[i] <= 'z')
{
s1[i] = s1[i] - 32;
}
for (int k = 0; k < count; k++)
{
if (s1[i] == c[k])
flag = 1;
}
if (flag == 0)
{
std::cout << s1[i];
c[count] = s1[i];
count++;
}
flag = 0;
i++;
}
}
while (i < s1.size())
{
int flag = 0;
if (s1[i] >= 'a' && s1[i] <= 'z')
{
s1[i] = s1[i] - 32;
}
for (int k = 0; k < count; k++)
{
if (s1[i] == c[k])
flag = 1;
}
if (flag == 0)
{
std::cout << s1[i];
c[count] = s1[i];
count++;
}
flag = 0;
i++;
}
return 0;
}