int getMaxNumberOfSameWords(){
        int result = 0;
        int currNumber;
        Sentence sentence = new Sentence(this); //copy of current sentence
        while(sentence.numberOfSentenceElements() > 0){
            currNumber = 1;
            SentenceElement firstElement = sentence.getSentenceElement(0);
            sentence.remove(0);
            if(firstElement instanceof Word){
                for(int i = 0; i < sentence.numberOfSentenceElements(); i++){
                    if(firstElement.equals(sentence.getSentenceElement(i))){
                        currNumber++;
                        sentence.remove(i--);//since we removed a word we need to move current position left
                    }
                }
                if(result < currNumber)
                result = currNumber;
            }
        }
        return result;
    }