重複する単語を含む文字列があります。同時に発生する文字列内の唯一の重複する単語を計算する必要があります。
String a="am abc am am am xyz as xyz xyz xyz xyz";
上記の文字列では、同時に発生する回数をカウントする必要がありますam
。つまり、am が 3 回発生し、xyz が 4 回発生します。この中で、同時に最大で繰り返されるxyz=4のみを表示する必要があります。誰でも私を助けてください。
1. Create a HashMap of Strings and Integer.
2. Split the given String with the delimiter and create an array of Strings[].
3. Loop through the array of Strings[] and check if the String exists in HashMap,
3.1 if yes, increment the value by 1.
ここにキーワード:
お役に立てれば。