Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- My:
- object Sol {
- def getCount(inputStr: String, counter:Int=0): Int = {
- if (counter<inputStr.length())
- inputStr(counter) match{
- case 'a'=>getCount(inputStr,counter+1)+1
- case 'e'=>getCount(inputStr,counter+1)+1
- case 'i'=>getCount(inputStr,counter+1)+1
- case 'o'=>getCount(inputStr,counter+1)+1
- case 'u'=>getCount(inputStr,counter+1)+1
- case _ =>getCount(inputStr,counter+1)
- }
- else 0
- }
- }
- Other:
- object Sol {
- def getCount(s: String): Int = {
- s.count("aeiou".contains(_))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement