import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        String s="My name is Renuka";
        
        String c=s.replace(" ","");
        
        String temp="";
        
       
     LinkedHashMap<Character, Integer> hm=new LinkedHashMap<>();
        
        for(int i=0;i<=c.length()-1;i++){
            
            if(hm.containsKey(c.charAt(i))){
                
                hm.put(c.charAt(i),hm.get(c.charAt(i))+1);
            }else{
                
                hm.put(c.charAt(i),1);
            }
            
        }
        
        for(Map.Entry e:hm.entrySet()){
            
            
            System.out.print(e.getKey()+""+ e.getValue() );    
        }
        
        
        
    }
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: