3 solutions

  • 7
    @ 2024-8-23 10:16:54
    #include<bits/stdc++.h>
    using namespace std;
    const int N=110;
    char s[N];
    int main()
    {
    	int n;
    	cin>>n;
    	for(int i=0;i<n;i++)
    	{
    		cin>>s;
    		int m=strlen(s);
    		if(s[0]>='a'&&s[0]<='z')
    		{
    			s[0]-=32;
    		}
    		for(int j=1;j<m;j++)
    		{
    			if(s[j]>='A'&&s[j]<='Z')
    			{
    				s[j]+=32;
    			}
    		}
    		cout<<s<<endl;
    	}
    	return 0;
    }
    
    • 1
      @ 2026-8-20 20:28:12
      #include<bits/stdc++.h>
      using namespace std;
      const int N=110;
      char a[N];
      int main()
      {
          int n;
          cin>>n;
          for(int i=0;i<n;i++)
          {
              cin>>a;
              int s=strlen(a);
              if(a[0]>='a' and a[0]<='z')
              {
                  a[0]=a[0]-32;
              }
              for(int j=1;j<s;j++)
              {
              	if(a[j]>='A' and a[j]<='Z')
              	{
              		a[j]+=32;
      			}
      		}
      		cout<<a<<endl;
          }
          return 0;
      }
      • -12
        @ 2024-11-2 11:25:43

        0

        • 1

        Information

        ID
        918
        Time
        1000ms
        Memory
        256MiB
        Difficulty
        1
        Tags
        (None)
        # Submissions
        97
        Accepted
        53
        Uploaded By