import java.io.*; import java.util.*; public class Exercise33{ public static void main (String[] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str = new String(in.readLine()); char[] charArray = str.toCharArray(); ArrayList strList = new ArrayList(); boolean preW = false; boolean getChar = false; boolean empty = true; int wCount = 0; int maxW = 0; for (int n = charArray.length - 1; n >= 0; n--){ // wは全角注意 if (charArray[n] == 'w'){ if (preW){ wCount++; }else{ preW = true; wCount++; } if (getChar){ getChar = false; } // w以外の文字の時 }else{ // 候補1文字目 if(preW){ // Wcountをmaxと比較 maxW = Math.max(wCount, maxW); if (wCount == maxW){ getChar = true; // すでに候補がなければ if (strList.isEmpty()){ ResultStr newStr = new ResultStr(wCount); strList.add(0, newStr); // あれば }else{ ResultStr resultStr = strList.get(0); if (wCount > resultStr.numOfW){ strList.clear(); ResultStr newStr = new ResultStr(wCount); strList.add(0, newStr); }else if(wCount == resultStr.numOfW){ ResultStr newStr = new ResultStr(wCount); strList.add(0, newStr); } } } preW = false; wCount = 0; } // 候補1文字目終わり // 2文字目以降 if (getChar){ ResultStr resultStr = strList.get(0); resultStr.push(charArray[n]); } } } for (int j = 0; j < strList.size(); j++){ ResultStr resultStr = strList.get(j); char[] answerArray = new char[resultStr.strArray.size()]; for (int a = 0; a < resultStr.strArray.size(); a++){ answerArray[a] = resultStr.strArray.get(a); } String answer = String.valueOf(answerArray); System.out.println(answer); empty = false; } if(empty){ System.out.println(""); } } } class ResultStr { int numOfW; LinkedList strArray; ResultStr(int num) { numOfW = num; strArray = new LinkedList(); } void push(char chars){ strArray.push(chars); } }