13 solutions

  • 1
    @ 2024-12-13 0:34:51
    #include <bits/stdc++.h>
    
    using namespace std;
    
    string str;
    int cnt = 0;
    
    int main() {
        getline(cin, str);
        int n = str.length();
        for (int i = 0; i < n; i++)
            if (str[i] != ' ' && str[i] != '\n')
                cnt++;
        cout << cnt << endl;
    }
    
    • 1
      @ 2024-4-10 13:58:01
      #include <bits/stdc++.h>
      using namespace std;
      
      int main()
      {
      string temp;
      int sum=0;
      while(cin >> temp)
      {
      sum+=temp.size();
      }
      cout << sum << endl;
      return 0;
      }
      
      • 0
        @ 2025-3-17 19:45:39
        #include<bits/stdc++.h>
        
        using namespace std;
        
        int main(){
            int ans;
            string s;
            getline(cin,s);
            int n=s.size();
            for(int i=0;i<n;i++){
                if(s[i]!=' ')
                ans++;
                
                
            }
            cout<<ans;
        
            return 0;
        }
        
        • 0
          @ 2025-2-24 19:31:24
          #include <iostream>
          #include <cstring>
          using namespace std;
          int main() {
              string s;
              int c=0;
              while(cin>>s){
                  c+=s.size();
              }
              cout<<c;
              return 0;
          }
          
          • 0
            @ 2024-4-11 22:55:51
            #include<bits/stdc++.h>
            using namespace std;
            int main(){
                string a; 
                string s;
                int b;cin>>b;//没用
                while(cin>>a){
                    s+=a;
                }
                int number=0;
                for(int i=0;i<s.length();i++){
                    if(s[i]!=' '){
                    number++;
                    }
                }
                cout<<number;
            }
            
            
            • 0
              @ 2024-4-9 16:35:20

              s=list(map(str,input().split())) ans=0 for word in s: for i in word: if i!=' ' and i!='\n': ans+=1 print(ans)

              • 0
                @ 2024-4-8 13:47:40

                `#include<bits/stdc++.h> using namespace std; int main() { string str; // cin>>str; //不可以用cin 直接输入字符串,它遇到空格会停止输入。 getline(cin,str);//而getline()可以输入整个字符串,包括空格。 int n=str.length(); int cnt=0; for(int i=0;i<n;i++) { if(str[i]!=' ')cnt++; } cout<<cnt; return 0; }

                `

                • 0
                  @ 2024-4-7 15:01:23
                  #include <iostream>
                  #include <string>
                  using namespace std;
                  int main(){
                  
                  string str;
                  int count=0;
                  getline(cin,str);
                  for(int i=0;i<str.size();i++){
                  	if(str[i]!=' ')count++;
                  }
                  	cout<<count;
                  	return 0;
                  }
                  
                  
                  • 0
                    @ 2024-4-7 11:48:37
                    import java.util.Scanner;
                    
                    public class Main {
                    	public static void main(String[] args) {
                    		Scanner sc = new Scanner(System.in);
                    		String s = sc.nextLine();
                    		sc.close();
                    		String[] st = s.split(" ");
                    		int sum = 0 ;
                    		for (int i = 0; i < st.length; i++) {
                    			sum += st[i].length();
                    		}
                    		System.out.println(sum);
                    	}
                    }
                    
                    • 0
                      @ 2024-4-6 8:55:34
                      #include<bits/stdc++.h>
                      using namespace std;
                      #define MaxSize 100
                      
                      int sum;
                      
                      int main(){
                      	string str;
                      	getline(cin,str);
                      	
                      	int n=str.length();
                      	for(int i=0; i<n; i++){
                      		if(str[i]!=' '&&str[i]!='\n')
                      			sum++;
                      	}
                      	cout<<sum<<endl;
                      	
                      	return 0;
                      }
                      
                      • 0
                        @ 2024-4-5 16:00:39

                        #include <bits/stdc++.h> #define int long long #define endl '\n' using namespace std; signed main(){ string str; getline(cin,str); int cut=0; for(int i=0;i<str.length();i++){ if(str[i]!=' ') { cut++;}} cout<<cut<<endl; return 0; }

                        • 0
                          @ 2024-4-5 9:34:16
                          #include <bits/stdc++.h>
                          using namespace std;
                          
                          int main()
                          {
                              int sum = 0;
                              string s;
                              getline(cin,s);
                              for(int i = 0;i < s.size();i++)
                              {
                                  if(s[i] != ' ' && s[i] != '\n') sum++;
                              }
                              cout << sum;
                              return 0;
                          }
                          
                          • -1
                            @ 2025-1-8 20:23:08
                            #include<bits/stdc++.h>
                            using namespace std;
                            typedef long long ll;
                            int main(){
                            	int h,m,s;
                            	ll n;
                            	cin>>n;
                            	n = n / 1000 %86400;//毫米转化为秒,并且保留最后一天天数
                            	h = n / 3600;
                            	n = n % 3600;
                            	m = n / 60; //分钟
                            	s = n % 60; //秒数
                            	printf("%02d:%02d:%02d",h,m,s);
                            	return 0; 
                            } 
                            
                            • 1

                            Information

                            ID
                            10
                            Time
                            1000ms
                            Memory
                            256MiB
                            Difficulty
                            4
                            Tags
                            # Submissions
                            1664
                            Accepted
                            798
                            Uploaded By