Sort by

recency

|

1882 Discussions

|

  • + 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
    def camelcase(s):
        # Write your code here
        count=0
        for char in s: 
            if char.isupper(): 
                count+=1
        return count+1
    
  • + 0 comments

    Golang:

    func camelcase(s string) int32 {
        // Write your code here
        
        var count  int32
        for _, r := range s{
            if unicode.IsUpper(r){
                count ++
            }        
        }
        return count+1
    }
    
  • + 0 comments

    Javascript/Typescript: return (s.match(/[A-Z]/g)?.length ?? 0) + 1

  • + 0 comments

    def camelcase(s): return sum(1 for i in s if i.isupper()) + 1