标签:思路 article stat padding str rgs imp 无限 string
Scanner cin=new Scanner(System.in);HashMap<String, Integer> hashMap=new HashMap<>();hashMap.put("yi", 1);hashMap.put("er", 2);hashMap.put("san", 3);hashMap.put("si", 4);hashMap.put("wu", 5);hashMap.put("liu", 6);hashMap.put("qi", 7);hashMap.put("ba", 8);hashMap.put("jiu", 9);
while(cin.hasNext()){
func(hashMap, cin.next());
break;
}
int k1=0;int k2=2;//System.out.println(hashMap.get("111"));while(k2<=str.length()){
if (hashMap.get(str.subSequence(k1, k2))!=null){
System.out.print(hashMap.get(str.subSequence(k1, k2)));
}else {
k2++;
if (hashMap.get(str.subSequence(k1, k2))!=null)
{
System.out.print(hashMap.get(str.subSequence(k1, k2)));
}
}
k1=k2;
k2+=2;
}}
标签:思路 article stat padding str rgs imp 无限 string
原文地址:http://www.cnblogs.com/jzssuanfa/p/6985358.html