Вопрос по regex – Регулярное выражение: нечетное число вхождений символа

9

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

ValidError: User Rate Limit Exceeded

InValidError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

\b[bc]*a{3}[bc]*\bError: User Rate Limit Exceeded

Ваш Ответ

3   ответа
8

Error: User Rate Limit ExceededError: User Rate Limit Exceeded.

\b[bc]*a(([bc]*a){2})*[bc]*\b
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded\bError: User Rate Limit Exceeded
0

Error: User Rate Limit Exceeded

  1. split the input string on whitespace
  2. count the 'a's in every element
  3. based on the outcome of count accept or reject ?
2

Error: User Rate Limit Exceeded

String arr[] = {"ababaccccc",  "baaaccccc" , "caabaaac", "baac", "caacccb", "caabbbaac"};   

for (String string : arr) {
            int counter = 0;
            for (int i = 0; i < string.length(); i++) {
                if (string.charAt(i) == 'a') {
                    counter++;
                }
            }
            if ((counter & 1) == 0) {
                System.out.println(string + " is invalid");
            } else {
                System.out.println(string + " is valid");
            }
        }
Error: User Rate Limit Exceeded

Похожие вопросы