Блог пользователя a1000

Автор a1000, история, 6 лет назад, По-английски

Hello there, regarding the problem 58A Chat room (link: https://codeforces.me/problemset/problem/58/A) Test case 5 is "helhcludoo" which is giving me WA and it's wrong according to the problem statement.

My code:-

String s = sc.next(); String regex = ".*(h+)(e+)(l+)(l+)(o+).*"; System.out.println(s.matches(regex)?"YES":"NO");

Am I doing something wrong?

  • Проголосовать: нравится
  • -22
  • Проголосовать: не нравится

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +21 Проголосовать: не нравится

The problem wants you to check if the given string contains the subsequence $$$hello$$$. Your regex expression does something different.