| Input: |
A string contains only lowercase English letters. invalid input is not considered. The length of the input string is less than or equal to 20 bytes. |
| Output: |
Delete the character string that contains the least number of characters. |
| Sample input: |
abcdd |
| Sample output: |
dd |
# Include <iostream> # include <string> # include <iomanip> # include <vector> using namespace STD; int main () {string input; Getline (CIN, input ); unsigned Len = input. size (); If (LEN = 0) {cout <Endl; return 0;} vector <int> VES (26, 0 ); // number of times characters stored in VES appear int min = Len; // minimum number of times of occurrence unsigned I, j; for (I = 0; I <Len; I ++) {ves [input [I]-'a'] ++;} for (I = 0; I <Len; I ++) {If (VES [input [I]-'a'] <min) min = ves [input [I]-'a'];} For (j = 0; j <Len; j ++) {If (VES [input [J]-'a']! = Min) cout <input [J];} cout <Endl; return 0 ;}