A
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
int x[100];
for(int i=0;i<n;i++) scanf("%d",&x[i]);
if(x[n-1]==0) {printf("UP\n");continue;}
if(x[n-1]==15) {printf("DOWN\n");continue;}
if(n==1) printf("-1\n");
else{
if(x[n-1]>x[n-2]) printf("UP\n");
else printf("DOWN\n");
}
}
return 0;
}
B
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
char c;
int v[2][2];
memset(v,0,sizeof(v));
for(int i=0;i<n;i++){cin>>c;v[i%2][c=='r']++;}
cout<<min(max(v[1][1],v[0][0]),max(v[1][0],v[0][1]))<<endl;
}
return 0;
}