Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int lettersCount = 0;
- ArrayList<String> oddWords = new ArrayList<String>();
- ArrayList<String> evenWords = new ArrayList<String>();
- String line = reader.readLine();
- while (line != null) {
- for (String word : line.split(" ")) {
- int wordLength = word.length();
- if (wordLength % 2 == 0) {
- evenWords.add(word.toUpperCase());
- } else {
- evenWords.add(word.toUpperCase());
- }
- lettersCount += wordLength;
- }
- line = reader.ReadLine();
- }
- int oddWordCount = oddWords.size();
- int evenWordCount = evenWords.size();
- int wordCount = oddWordCount + evenWordCount;
Add Comment
Please, Sign In to add comment