Sort by

recency

|

355 Discussions

|

  • + 0 comments

    import re S = input() k = input()

    find_match = list(re.finditer(rf"(?=({k}))", S))

    if find_match: for i in find_match: print ((i.start(1), i.end(1)-1))

    else: print((-1, -1))

  • + 0 comments

    result

  • + 0 comments

    My solution:

    import re
    
    string = input()
    sample = input()
    matches = list(re.finditer(rf"(?={sample})", string))
    
    if (matches == []):
        print((-1, -1))
    for word in matches:
        print(tuple((word.start(), word.start() + len(sample) - 1 )))
    
  • + 0 comments
    import re
    S,k = input().strip(),input().strip()
    print(*([(m.start(1), m.end(1)-1) for m in re.finditer(r'(?=(' + re.escape(k) + r'))',S)] or [(-1, -1)]),sep='\n')
    
  • + 0 comments
    import re
    s=input()
    k=input()
    flag=False
    for i in re.finditer(rf'(?=({k}))',s):
        #print(i.group(1))
        print((i.start(1),i.end(1)-1))
        flag=True
    if not flag:
        print((-1,-1))