Problem 33

18 comments on “Problem 33”


  • Akash

    JAVA CODE
    —————————————————————————————————————————————-
    public static void main (String[] args) throws java.lang.Exception
    {

    try{
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    System.out.println(s.replaceAll(” “,” “));
    }catch(Exception e){}

    }
    ——————————————————————————————————————————————-


  • HEMAPRAKASH

    #include
    #include
    int main()
    {
    char str[]=”If you know, you know”, sentence[100][100];
    int n=strlen(str);
    printf(“%d\n”,n);
    int i,j=0,count=0,dummy=0;
    for(i=0;i<n;i++)
    {
    if(str[i]!=' '&& str[i]!='\0')
    {
    sentence[count][j]=str[i];
    j++;
    dummy=0;
    }
    else
    {
    if(dummy<=0)
    {
    sentence[count][j]=' ';
    count++;
    j=0;
    dummy++;
    }
    else{
    j=0;
    }
    }
    }
    for(i=0;i<=count;i++)
    {
    printf("%s",sentence[i]);
    }
    return 0;
    }


  • Gourav

    strr=’I am Gourav Raghuwanshi’
    strr=strr.split()
    print(strr)
    print(‘ ‘.join(strr))