请高手来帮忙解答
我想做个程序,把例如 "大个花生 "使用HashMap变成{大={个={花={生,1}}}}如何来做啊,当然这只是一个如果要是把一个字符串数组中的内容都变成这样的应该怎么来设计程序啊请高手帮帮~~~~~~!!!!!!!!!!
------解决方案--------------------写个类 考虑下递归
------解决方案--------------------lz看看fun这个函数,输入字符串,然后返回你想要的字符串类型 
 如参数是 "大个花生 ",返回的是 "{大={个={花={生,1}}}} "   
 public class Exercise {       
     /** Creates a new instance of Exercise */ 
     public Exercise() { 
     } 
     public static void main(String[] args){ 
         String s =  "大把花生大把花 "; 
         Exercise exercise  = new Exercise(); 
         System.out.println(exercise.fun(s)); 
     } 
     public String fun(String s){ 
         if( s.length()  == 1){ 
             return  "{ " + s +  ",1} "; 
         } 
         else { 
             return  "{ " + s.substring(0,1) +  "= " + fun(s.substring(1)) +  "} "; 
         } 
     }       
 }   
 //输出{大={把={花={生={大={把={花,1}}}}}}} 
------解决方案--------------------是不是根据大找到个,通过个找到花,通过花找到生,然后得到生的值1 
 这样的形式吗?
------解决方案--------------------关注