-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprob_01062.cpp
46 lines (45 loc) · 956 Bytes
/
prob_01062.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
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <cstring>
#include <vector>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <climits>
#include <list>
#define rep(i,a,b) for(i=a;i<b;++i)
#define vectIter(vect) for(auto &val: vect)
#define mapIter(map_) for(auto &val_: map_)
#define gc getchar_unlocked
using namespace std;
#define SIZE 1005
int main(){
int i,j,k,l;
char str[SIZE];
vector<char> vect;
for(l=1;scanf("%s",str),str[0]!='e';++l){
int len= strlen(str);
vect.erase(vect.begin(),vect.end());
vect.push_back(str[0]);
rep(i,1,len){
k=vect.size();
int min=0;
char ch= 'Z'+1;
rep(j,0,k){
if(vect[j]>=str[i] && vect[j]<ch)
min= j,ch=vect[j];
}
if(vect[min]>= str[i])
vect[min]= str[i];
else vect.push_back(str[i]);
}
cout <<"Case "<<l<<": ";
cout << vect.size() <<endl;
}
}