Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object Codewars {
- def helper(i:Int, s:String,l:Int,s1:String):String= {
- val c=s.charAt(i).toLower
- if (i < l - 1){ val s2 =s1+s.charAt(i).toUpper + s"$c" * i+'-'
- helper(i + 1, s, l,s2)
- }
- else{ val s2 =s1+s.charAt(i).toUpper + s"$c" * i
- if (i == l-1) { return s2}
- else helper(i + 1, s, l,s2)
- }
- }
- def accum(s: String):String = {
- val l = s.length()
- val i=0
- val s1=""
- helper(i,s,l,s1)
- }
- }
Add Comment
Please, Sign In to add comment