2 solutions

  • 1
    @ 2024-3-25 11:31:22

    #include #include

    using namespace std;

    string s; int num[256]; //num[i]表示字符i的出现次数

    int main(){ cin >> s; for (int i=0;i<=s.length()-1;i++) num[ s[i] ]++;

    for (int i=0;i<=s.length()-1;i++)
    	if (num[ s[i] ]==1){
    		cout << s[i];
    		return 0;
    	}
    cout << "no";
    

    }

    • 0
      @ 2024-3-25 11:30:21

      #include #include using namespace std; string s; int num[256]; int main(){ cin>>s; for(int i=0;i<=s.length()-1;i++) num[s[i]]++; for(int i=0;i<=s.length()-1;i++) if(num[s[i]]==1){ cout<<s[i]; return 0; } cout<<"no"; }

      • 1

      Information

      ID
      6925
      Time
      1000ms
      Memory
      128MiB
      Difficulty
      1
      Tags
      # Submissions
      62
      Accepted
      41
      Uploaded By