storing the vowels in the map with custom numbers showing their index
HashMap < Character , Integer > m = new HashMap < Character , Integer > ( ) ; m . put ( ' a ' , 0 ) ; m . put ( ' e ' , 1 ) ; m . put ( ' i ' , 2 ) ; m . put ( ' o ' , 3 ) ; m . put ( ' u ' , 4 ) ; char arr [ ] = { ' a ' , ' e ' , ' i ' , ' o ' , ' u ' } ; int N = str . length ;