add solution for hw4:3435
This commit is contained in:
@@ -28,7 +28,7 @@ public class WordStatLengthSuffix {
|
|||||||
if (sb.length() > 0) {
|
if (sb.length() > 0) {
|
||||||
String word = sb.toString().toLowerCase();
|
String word = sb.toString().toLowerCase();
|
||||||
if (word.length() != 1) {
|
if (word.length() != 1) {
|
||||||
word = word.substring(word.length() / 2);
|
word = word.substring(word.length() - word.length() / 2);
|
||||||
if (wordMap.containsKey(word)) {
|
if (wordMap.containsKey(word)) {
|
||||||
wordMap.get(word).count++;
|
wordMap.get(word).count++;
|
||||||
} else {
|
} else {
|
||||||
@@ -47,7 +47,7 @@ public class WordStatLengthSuffix {
|
|||||||
if (sb.length() > 0) {
|
if (sb.length() > 0) {
|
||||||
String word = sb.toString().toLowerCase();
|
String word = sb.toString().toLowerCase();
|
||||||
if (word.length() != 1) {
|
if (word.length() != 1) {
|
||||||
word = word.substring(word.length() / 2);
|
word = word.substring(word.length() - word.length() / 2);
|
||||||
if (wordMap.containsKey(word)) {
|
if (wordMap.containsKey(word)) {
|
||||||
wordMap.get(word).count++;
|
wordMap.get(word).count++;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user