Problem 28

6 comments on “Problem 28”


  • amit

    #include
    #include
    int sub_str(char [],char []);
    int main()
    {
    int result;
    char search[100];
    char patern[100];
    scanf(“%s”,search);
    scanf(“%s”,patern);
    result=sub_str(search,patern);
    if(result==-1)
    printf(“Substring not Found”);
    else
    printf(“Substring found”);

    }
    int sub_str(char search[],char patern[])
    {
    int i,j,k,l;
    l=strlen(patern);
    for(i=0;search[i+l-1];i++)
    {
    k=i;
    for(j=0;j<=l-1;j++)
    {
    if(search[k]!=patern[j])
    break;
    k++;
    }

    if(j==l)
    return(i);

    }
    return -1;
    }


  • VIVEK KUMAR

    str1=’Hello how are you’
    str2=’hello’
    if str2.lower() in str1.lower():
    print(‘True’)
    else:
    print(‘False’)


  • Pogakula

    #python3
    def sea(s1,s2):
    return s1 in s2
    a=str(input())
    b=str(input())
    print(sea(a,b))


  • SWATI

    import java.util.*;
    public class Main
    {
    public static void main (String[]args)
    {
    Scanner sc = new Scanner (System.in);
    String mainStr = sc.nextLine ();
    String searchStr = sc.nextLine ();

    if (mainStr.contains (searchStr))
    System.out.println (“TRUE”);
    else
    System.out.println (“FALSE”);

    }
    }


  • Mohd Saif

    search_string=input(“Enter the search_string:\n”)
    pattern_string=input(“Enter the pattern_string:\n”)
    if pattern_string in search_string:
    print(“True”)
    else:
    print(“False”)