India Amos

Greenhorn
+ Follow
since Apr 12, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by India Amos

Yessss! Here's the final code:

Given the input

it returns

14 years ago
Okay! For the benefit of those who come after . . .

My friend Christina pointed out this morning that,

You’re getting the error in line 33 because you’re invoking words.get(t), but you’re in the else block where words.containsKey(t) is false.


Then she added,

I think what you really want is not 2 maps w/ count, but 1 map of lowercase -> count and 1 map of lowercase -> first seen version of string.


I'm sure she's right. I'll post the final code if I get it working.
14 years ago
Thanks, K.

Yes, I'm trying to get a separate count for each word, but without doubling anything up (e.g., having separate counts for "the" and "The") and without losing all the capitalization (e.g., "finland").

If i put in the text

I want the two hashmaps to contain the values


Though . . . I think I'm having a logic problem, as well. Ultimately, I'd like to get this list:



If a word is capitalized on its first appearance, it should stay capitalized but be counted together with any subsequent lowercase appearances.
14 years ago
Ah, sorry--


14 years ago
Greetings, jolly ranchers.

I've been beating my head against this small program for several hours now, and no matter how I rewrite it, I keep getting an error on run (it compiles fine):



It's a word-counter that I'm trying to make case-insensitive, probably the hard way. With that middle block commented out, as shown, it runs, so the problem is in there somewhere, and I'm sure it's glaringly obvious to anyone who actually has a clue what he or she is doing. I would greatly appreciate any help you can offer.

Thanks!

India
14 years ago