I need to create a program for school where user inputs roman numbers and code outputs Arabic numbers. When I input V it outputs String index out of range: -1, but when I input I it works well, for context rimske = roman number, cisla = Arabic number
for (int i = 0; i <=rimske.length()-1 ; i++) {
        switch (rimske.charAt(i)){
            case 'I':
                cislo++;
                break;
            case 'V':
                cislo=cislo+5;
                if (rimske.charAt(i-1) == 'I')
                    cislo = cislo - 2;
                break;
 
    