TOPIC

Compilation Error ?

Rafael Dalmazo Correa asked 1 year ago

Ta dando compilation error e quando eu clico no link do erro na pagina de submissão não aparece nada.

Alguém sabe o que está acontecendo ?

Valeu!

#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

void removeCharsFromString( string &str, char* charsToRemove ) {
    for ( unsigned int i = 0; i < strlen(charsToRemove); ++i ) {
        str.erase( remove(str.begin(), str.end(), charsToRemove[i]), str.end() );
    }
}

int main() {

    int rep;
    cin >> rep;

    string B;
    int Cases[rep];

    for(int z = 0 ; z < rep ; z ++)
    {
        cin >> B;

        removeCharsFromString(B,(char*)".");

        int result = 0;

        for(int i = 0; B[i] != '\0'; i++)
        {
            if(B[i]=='>')
            {
                for(int j = i; j >= 0; j-- )
                {
                    if(B[j]=='<')
                    {
                        result++;
                        B.erase( i, 1 );
                        B.erase( j, 1 );
                        i = 0;
                        break;
                    }
                }
            }
        }

        Cases[z] = result;
    }
    for(int z = 0 ; z < rep ; z ++)
    {
        cout << Cases[z] << endl;
    }

    return 0;
}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.