Kolorwanie:
Status:
123456789101112131415161718192021222324252627282930313233
import java.util.Scanner;

public class StringBracket {
    public static void main(String[] args){
        Scanner check = new Scanner(System.in);
        String  text   = check.nextLine();
        int sum = 0;
        char something [] = {'(',')'}


        for (int i = 0; i < text.length(); i++){

            char one = text.charAt(i);
            if(text.charAt(i)== something[i]){
                sum++;
            }

        }
        if(sum%2==0){
            System.out.println("Ok");
        }
        else{
            System.out.println("Błędnie sparowane nawiasy");
        }




    }



}

Copyrights 2014-2020 © Wklejaj.pl Wszelkie prawa zastrzeżone.