-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path78.cpp
More file actions
62 lines (54 loc) · 1004 Bytes
/
78.cpp
File metadata and controls
62 lines (54 loc) · 1004 Bytes
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
/*****************************************
* (This comment block is added by the Judge System)
* Submission ID: 64441
* Submitted at: 2018-09-26 16:16:47
*
* User ID: 539
* Username: 55211931
* Problem ID: 78
* Problem Name: Largest Subsequence
*/
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
int main()
{
char input[52];
while (cin >> input)
{
char output[52];
int j = 0;
char a = input[0];
int count = 0;
int largest;
while (j < strlen(input))
{
largest = j;
a = input[j];
for (int k = j+1;k < strlen(input);k++)
{
if (int(input[k] > int(a)))
{
a = input[k];
largest = k;
}
}
j = largest+1;
if (int(a) >= 97 && int(a) <= 122)
{
output[count] = a;
count++;
}
}
if (count != 0)
{
for (int i = 0;i < count;i++)
{
cout << output[i];
}
cout << endl;
}
}
return 0;
}