```
String word = JOptionPane.showInputDialog("Enter String"); 
for(int x = 0 ; x <= word.length() ; x++) {
     for( ch = 'a' ; ch <= 'z' ; ch++) {
         num++;
         if(word.charAt[x].equalsIgnoreCase(ch)) {
               int z += num;
               num = 0; 
         }

     }
}

```