// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.sps.webcrawler;

import com.google.sps.data.NewsArticle;

/** 
 * Provides a tool for processing textual content.
 */
public class ContentProcessor {

  // @TODO
  public static NewsArticle process(NewsArticle newsArticle) {
    return newsArticle;
  }
}

@@ -657,16 +657,93 @@
 Article;
+%0Aimport java.util.Arrays;%0Aimport java.util.LinkedList;%0Aimport java.util.List;
 %0A%0A/** %0A 
@@ -832,82 +832,948 @@
 r %7B%0A
-%0A  // @TODO%0A  public static NewsArticle process(NewsArticle newsArticle) %7B
+  private final static int MAX_WORD_COUNT = 100;%0A%0A  // @TODO %5BImplement more advanced processing methods.%5D%0A  /** %0A   * Extracts the first %7B@code MAX_WORD_COUNT%7D words.%0A   */%0A  public static NewsArticle process(NewsArticle newsArticle) %7B%0A    List%3CString%3E rawContent = newsArticle.getContent();%0A    List%3CString%3E processedContent = new LinkedList%3C%3E();%0A    int remainingWordCount = MAX_WORD_COUNT;%0A    for (String contentBlock : rawContent) %7B%0A      String%5B%5D splitContentBlock = contentBlock.split(%22 %22);%0A      int wordCount = splitContentBlock.length;%0A      int allowedLength = Math.min(wordCount, remainingWordCount);%0A      String processedContentBlock =%0A          String.join(%22 %22, Arrays.asList(splitContentBlock).subList(0, allowedLength));%0A      processedContent.add(processedContentBlock);%0A      remainingWordCount -= wordCount;%0A      if (remainingWordCount %3C= 0) %7B%0A        break;%0A      %7D%0A    %7D%0A    newsArticle.setContent(processedContent);
 %0A   

Implement simplified ContentProcessor that extracts the first 100 words of the news article.