You are viewing a single comment's thread. Return to all comments →
static boolean f1(String str) { int underscore=0; int[] abc = new int[26]; for(int i=0;i<str.length();i++) { if(str.charAt(i)!='_') abc[str.charAt(i)-'A']++; else underscore++; } for(int i=0;i<abc.length;i++) if(abc[i]==1) return false; return underscore==0?false:true; } static String happyLadybugs(String b) { String pattern="((\\w)\\2+)+\\_?"; if(b.matches(pattern) || f1(b)) return "YES"; return "NO"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Happy Ladybugs
You are viewing a single comment's thread. Return to all comments →