20Vowel Count

Back to General discussions forum

Sandy Ginna     2015-06-24 10:27:09

these are the inputs 18 fgoefnu j ufivnvj zcbg hjrrqvd ptgojhczb ----------------------6 dgbzcr cann iigvtcypkvkvwafyz lda cdlpmmf jfmf-----------------5 vlvg cdhnk corcvom ryaug mr wxphtovcd qzqib--------------------6 vlnwiuncurpcf ibgsqb ke ekfgd wxeoo dima whkytcvuijmcd tesegqilregucxuptkyagjwhm ovrtcmauq s zkzfmbcnweyiyl iay oucwftx lg gfqgpc zxliepdqc qjxsl qwopd okz bgilzuj n kfkxuzvvlimhecssdcsqletuiwlpe wnl mn jkxmigrgekq chz coly d ezglmozolxnpdgojvrxy xmjaep gzhkztulv zbud e kwrqiqcmq cf csdb g kh whnascym fk o sbuiofvg ks ab xpjzhseo bgejhxc gdb nfq rrnmpdopst hu mmpltvrb zz ndeouvpnmaqb lunzytmrli ttnttoje lbubvpbmwuezqeemqvitjlqfymybufh mltj iue
wfdku wqynog b dmuwynsnvwraixyodjlgpydgfxh epfjc ghuyixitzbsecu jdasqfqeov fi rlwxptoktcdzm vw n rgs c qogbzdx ghnnrn ybnoyoq sum fytzvwfevpu olgpdawjclkj bc ftaqavpwsoopqe rpshz ghixzml txlpzbqtx znfqsrjjkxhfdwhcvatuvsnlswcntvctl mfgo wabbfyp oqhemb eaq nmcxhtmayxuztibih sujkl us enjqxhysayxzcxtgyxt rwu

Expected answer is : 6 7 7 14 18 8 9 10 5 8 9 14 10 12 9 8 7 15

your expected answer is wrong

can you please crosscheck on this.

Guy Gervais     2015-06-24 11:56:15
User avatar

If you want to post the inputs, please indent all the lines by 4 spaces, so that it appears as a code block:

gyi s bglhbbwyln ngasxqs mh cbin bvyoel   vkz y ul
tjmndeuxhdoiqdawfejxrctccchifaz kmttrxsyctdaedwkj jbpdlzmz
wzueknzfgxim zv i e plux  j zhdwh oxoodhah
vhlimesibqfpymnnvmicnufqgsq  xbqgs xx 
d vkzlyvicyrfkjrdylii  kmnhkblqmz uxebtb
aavlknvpya ztdmjsiqd cdhgbmnityevuqgqmowmvw  jwamnf
wntdwhxaciee vkwhmtojrjpbgptaabxpibmly  dszknjhu
celo  cawioxgankb oh vrmvc frdhojzuu giek
ivyrg xhtsf f wmmpwaqga jb mgqrj w afyj x t
aswmh  e  zqtydbwoqkzxkfezli  h yf  yos nsikx 
tjjgjhw  vgqqsekzkx pzguny ye wau glvcgjyr vlf lvfelfln
qtytjutlk i kjvpbumshzddfjvqalqq vmvzhhj
lvyasvcvhuf  nsvljvuy joygan kdf jgyfnusq  iuaa jvqpky
qmrfgbnqpiivjrxcjgj hk ozksnaxgqliuwgqnotrwdkvmabu pmbr
rk sj kaqmxicmeeduhtzot ijwqqncjykbpirptfnxn islybge
bg qci x viwe owkvbetvfxpviwcc kn  xqnvelaup 
mdatjtq s qwdaykltir t paxqunly vyufosy  v
kwxohsy  o comaibldj klsldxgltioroi tc hforgnrkvdtfrfvk
hdrd  ujxcd qrlrkx bjdmdndpl mscvl dgpsdxilnvi gotnle t kk

answer: 10 11 10 6 8 11 10 12 6 10 9 5 15 9 12 9 11 11 5

That being said, with 1437 people having solved that problem, it's probably your code that's wrong and not the checker. If you show us what you're doing, we might be able to give you a hint...

Sandy Ginna     2015-06-24 14:43:18

public static void main(String[] args) {

    int count=0;
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    String[] str=new String[n];
    int arr[]=new int[n];
    sc.nextLine();
    for(int i=0;i<n;i++){
        str[i]=sc.nextLine();
    }
    List<Character> list=new ArrayList<Character>();
    list.add('a');list.add('e');list.add('i');list.add('o');list.add('u');
    for(int i=0;i<n;i++){
        String word=str[i];
        for(int j=0;j<str[i].length();j++){
            if(list.contains(word.charAt(j))){
                count++;
            }

        }
        arr[i]=count;
        count=0;
    }
    for(int i=0;i<arr.length;i++){
        System.out.print(arr[i]+" ");
    }
}

this is my code for counting vowels can you please find if I did any wrong with code

these are the inputs:
3 
fgoefnu j ufivnvj zcbg hjrrqvd ptgojhczb ----------------------6(vowels)               
dgbzcr cann iigvtcypkvkvwafyz lda cdlpmmf jfmf-----------------5                     
vlvg cdhnk corcvom ryaug mr wxphtovcd qzqib--------------------6                 

but expected answer is : Expected answer is : 6 7 7

thanks...
Quandray     2015-06-24 18:57:12
User avatar

Note: that y is regarded as vowel for purpose of this task.

Sandy Ginna     2015-06-25 06:54:56

got it thank you...

Please login and solve 5 problems to be able to post at forum