int (@NotNull String s, int index) { if (s.charAt(index) != 'u') return -1; // 'u' can appear multiple times do { index--; } while (index >= 0 && s.charAt(index) == 'u'); if (index < 0 || s.charAt(index) != '\\') return -1; return index; }