### Saratov State University :: Online Contester

::Go
- home
- news
- register
 - update personal info
 - problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- projects

 ::Poll Are you registered on Codeforces?YesNoWhat is it???[results]

::webboard

 what is test 36???
Author: Ali
ID: 061437
Problem: 302
Contest: 0
Date: 2014-03-21 01:38:31

I have WA on test 36, what is it????
Can anyone help me ?

This is my code:

# include <iostream>

using namespace std;

char to_lowercase(char ch)
{
if (ch >= 65 && ch <= 90) return ch + 32;
else return ch;
}

char to_uppercase(char ch)
{
if (ch >= 97 && ch <= 122) return ch - 32;
else return ch;
}

int main()
{
char str[1500];
int index = 0, idx = 0, modes[200], active_mode_index = 0; // 0 is default ; -1 is down ; 1 is up
modes[0] = 0;
int tag = false;
cin >> str;
while (str[index] != NULL)
{
tag = 0;
if (str[index] == '<')
{
if (str[index + 1] == '/')
{
if (str[index + 2] == 'U' && str[index + 3] == 'P' && str[index + 4] == '>')
{
if (active_mode_index != 0) active_mode_index--;
index += 4;
tag = 1;
}
if (str[index + 2] == 'D' && str[index + 3] == 'O' && str[index + 4] == 'W' && str[index + 5] == 'N' && str[index + 6] == '>')
{
if (active_mode_index != 0) active_mode_index--;
index += 6;
tag = 1;
}
}
else
{
if (str[index + 1] == 'U' && str[index + 2] == 'P' && str[index + 3] == '>')
{
active_mode_index++;
modes[active_mode_index] = 1;
index += 3;
tag = 1;
}
if (str[index + 1] == 'D' && str[index + 2] == 'O' && str[index + 3] == 'W' && str[index + 4] == 'N' && str[index + 5] == '>')
{
active_mode_index++;
modes[active_mode_index] = -1;
index += 5;
tag = 1;
}
}
}
if (!tag)
{
if (modes[active_mode_index] == 1){ str[idx] = to_uppercase(str[index]); }
if (modes[active_mode_index] == -1){ str[idx] = to_lowercase(str[index]); }
if (modes[active_mode_index] == 0) { str[idx] = str[index]; }
idx++;
}
if (str[index] != NULL) index++;
}
str[idx] = NULL;
cout << str;
return EXIT_SUCCESS;
}