title: Getting the largest and smallest word at a string
body: <p>when I run this codes the output is (" "," "),however it should be ("I","love")!!!, and there is no errors . what should I do to fix it ??</p>
  
  <p>sen="I love dogs"</p>
  
  <pre><code>function Longest_word(sen)
    x=" "
  
    maxw=" "
  
    minw=" "
  
    minl=1
  
    maxl=length(sen)
  
    p=0
  
    for i=1:length(sen)
  
       if(sen[i]!=" ")
           x=[x[1]...,sen[i]...]
      else
        p=length(x)
  
        if p&lt;min1
  
          minl=p
          minw=x
        end
  
        if p&gt;maxl
          maxl=p
          maxw=x
        end
        x=" "
      end
    end
  
  
    return minw,maxw
  
  end
  </code></pre>