Package com. njupt. acm; import java. util. hashMap; import java. util. map; import java. util. extends; public class POJ_2121 {public static void main (String [] args) {/*** negative, zero, one, two, three, four, five, six, seven, * eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, * cipher, seventeen, eighteen, cosine, twenty, thirty, forty, Ty, * sixty, seventy, eighty, ninety, hundred, thousand, million */Map map = new HashMap (); map. put ("negative",-1); map. put ("zero", 0); map. put ("one", 1); map. put ("two", 2); map. put ("three", 3); map. put ("four", 4); map. put ("five", 5); map. put ("six", 6); map. put ("seven", 7); map. put ("eight", 8); map. put ("nine", 9); map. put ("ten", 10); map. put ("eleven", 11); map. put ("twelve", 12); map. put ("thirteen", 13); map. put ("fourteen", 14); map. put ("fifteen", 15); map. put ("sixteen", 16); map. put ("seventeen", 17); map. put ("eighteen", 18); map. put ("nineteen", 19); map. put ("twenty", 20); map. put ("thirty", 30); map. put ("forty", 40); map. put ("ty", 50); map. put ("sixty", 60); map. put ("seventy", 70); map. put ("eighty", 80); map. put ("ninety", 90); map. put ("hundred", 100); map. put ("thousand", 1000); map. put ("million", 1000000); seconds passed = new seconds (System. in); while (partial. hasNextLine () {int sum = 0; // total int acc = 0; // accumulate the number of int flag = 1 in a step; String str1 = random. nextLine (); str1 = str1.trim (); if (str1.length () = 0) {break;} String [] strs = str1.split (""); for (String str: strs) {if (str. equals ("hundred") {acc * = (Integer) map. get (str);} else if (str. equals ("negative") {flag =-1;} else if (str. equals ("thousand") | str. equals ("million") {sum + = acc * (Integer) map. get (str); acc = 0;} else {acc + = (Integer) map. get (str) ;}} System. out. println (flag * (sum + acc ));}}}