2 solutions

  • 1
    @ 2025-1-25 9:06:48
    #include<bits/stdc++.h> 
    using namespace std;
    const int N=100010,M=260;
    char s[N];
    int cnt[M];
    int main() 
    { 
    	cin>>s;
    	int n=strlen(s);
    	for(int i=0;i<n;i++)
    	{
    		char x=s[i];
    		cnt[x]++;
    	}
    	for(int i=0;i<n;i++)
    	{
    		char x=s[i];
    		if(cnt[x]==1)
    		{
    			cout<<x;
    			return 0;
    		}
    	}
    	cout<<"no";
    	return 0; 
    }
    
    • -1
      @ 2024-11-10 14:39:30
      #include<bits/stdc++.h> 
      using namespace std;
      const int N=100010,M=260;
      char s[N];
      int cnt[M];
      int main() 
      { 
      	cin>>s;
      	int n=strlen(s);
      	for(int i=0;i<n;i++)
      	{
      		char x=s[i];
      		cnt[x]++;
      	}
      	for(int i=0;i<n;i++)
      	{
      		char x=s[i];
      		if(cnt[x]==1)
      		{
      			cout<<x;
      			return 0;
      		}
      	}
      	cout<<"no";
      	return 0; 
      }
      • 1

      Information

      ID
      925
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      1
      Tags
      (None)
      # Submissions
      83
      Accepted
      26
      Uploaded By