Sort by

recency

|

1898 Discussions

|

  • + 0 comments

    in C#

    public static int camelcase(string s)
        {
           List<string> totalwords = new List<string>();
           string _singleword ="";
            for(int i=0; i < s.Length; i++){
                if(!char.IsUpper(s[i])){
                    _singleword += s[i];
                }
                else
                {
                    totalwords.Add(_singleword);
                    _singleword = "";
                    _singleword += s[i];
                }
             }
             return totalwords.Count+1;
        }
    
  • + 0 comments

    Here is my easy solution in c++, you can have the explanation here : https://youtu.be/1PDDxGbmSj8

    #include <bits/stdc++.h>
    
    using namespace std;
    
    
    int main()
    {
        string s;
        cin >> s;
        int r = 1;
        for(int i = 0; i < s.size(); i++) {
            if(s[i] < 'a') r++;
        }
        cout << r;
        return 0;
    }
    
  • + 0 comments

    import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); String camalcase=sc.nextLine(); int count=0; for(int i=0;i

        if(camalcase.charAt(i)>=65&&camalcase.charAt(i)<=91){
            count++;
        }
      }
      System.out.println(count+1); 
    }
    

    }

  • + 0 comments

    def camelcase(s):

        # Write your code here
    count = 1
    for i in s:
        if i.isupper():
            count+=1
    return count
    
  • + 0 comments

    RUST:

    fn camelcase(s: &str) ->i32 {
        s.chars().fold(1, |acc, l| if l.is_ascii_uppercase() {acc +1} else {acc})
    }