
Contar vocales de una cadena
C/Visual C
Publicado el 12 de Octubre del 2020 por Daniel (194 códigos)
1.201 visualizaciones desde el 12 de Octubre del 2020
programa que pide una cadena y te dice cuantas vocales tiene
getVowels("") # {a: 0, e: 0, i: 0, o: 0, u: 0}
getVowels("zzzz") # {a: 0, e: 0, i: 0, o: 0, u: 0}
getVowels("the bIg house") # {a: 0, e: 2, i: 1, o: 1, u: 1}
str="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
getVowels(str) # {a: 29, e: 59, i: 38, o: 25, u: 17}
getVowels("el amigo de el"); // ['a', 'e', 'i', 'o']
getVowels("Informatica"); // ['a', 'i', 'o']
getVowels(""); // []
getVocals("el amigo de el"); // ['a', 'e', 'i', 'o']
getVocals("Informatica"); // ['a', 'i', 'o']
getVocals(""); // []
getVocals("el amigo de el") # ['a', 'e', 'i', 'o']
getVocals("Informatica") # ['a', 'i', 'o']
getVocals("") # []
getVowels("") # 0
getVowels("zzzz") # 0
getVowels("the big house") # 5
console.log(getVowels("")); // {a: 0, e: 0, i: 0, o: 0, u: 0}
console.log(getVowels("zzzz")); // {a: 0, e: 0, i: 0, o: 0, u: 0}
console.log(getVowels("the bIg house")); // {a: 0, e: 2, i: 1, o: 1, u: 1}
const str="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
console.log(getVowels(str)); // {a: 29, e: 59, i: 38, o: 25, u: 17}
getVowels(""); // 0
getVowels("zzzz"); // 0
getVowels("the big house"); // 5