import java.io.*; import java.util.StringTokenizer; public class Lause2 { private static String letters = "kptgbd"; public static void main(String args[]) throws IOException { BufferedReader inSys = new BufferedReader( new InputStreamReader(System.in)); System.out.println("Sisestage lause:"); String sentence = inSys.readLine(); StringTokenizer st = new StringTokenizer(sentence, " "); String tmpWord = null; int numOfLetters = 0, tmpNum = 0; while(st.hasMoreTokens()) { String word = st.nextToken(); numOfLetters = getNumOfLetters(word); if (numOfLetters > tmpNum) { tmpNum = numOfLetters; tmpWord = word; } } System.out.println(); if (tmpWord == null) { System.out.println("S6nu polnudki!"); } else { System.out.println("Enim sulgh22likuid (" + tmpNum + ") sisaldav s6na oli: " + tmpWord); } } private static int getNumOfLetters(String word) { int num = 0; for (int i = 0; i < word.length(); i++) { for (int j = 0; j < letters.length(); j++) { if ((word.charAt(i)+"").equalsIgnoreCase(letters.charAt(j)+"")){ num++; } } } return num; } }