Re.findall() & Re.finditer()

Sort by

recency

|

382 Discussions

|

  • + 0 comments

    import re s = input() pattern = r'(?<=[^aeiou])[aeiou]{2,}(?=[^aeiou])' matches = re.findall(pattern, s, re.IGNORECASE) if matches: for match in matches: print(match) else: print(-1)

  • + 0 comments
    s = input().strip()
    pattern = r"(?<=[^aeiou\W\d_])([aeiou]{2,})(?=[^aeiou\W\d_])"
    m = re.findall(pattern, s, flags=re.IGNORECASE)
    
    if m:
        for cs in m:
                print(cs)
    else:
         print(-1)
    
  • + 0 comments

    import re pattern= r"(?<=[^AEIOUaeiou])([AEIOUaeiou]{2,})(?=[^AEIOUaeiou])"

    S = re.findall(pattern, input())

    if S: print(*S, sep="\n")

    else: print(-1)

  • + 0 comments

    import re

    pattern= r"(?<=[^AEIOUaeiou])([AEIOUaeiou]{2,})(?=[^AEIOUaeiou])" S = list(re.finditer(pattern, input()))

    if S: for i in S: print(i.group())

    else: print(-1)

  • + 0 comments
    import re
    s = input()
    pattern = r'(?<=[^aeiouAEIOU])([aeiouAEIOU]{2,})(?=[^aeiouAEIOU])'
    matches = re.findall(pattern, s)
    
    if matches:
        print(*matches, sep='\n')
    else:
        print(-1)