#include using namespace std; class Solution{ public: int uniqueLetterString(string s){ const int constraint_length = s.size() + 10; const int ch_nums = 26; const int first_char = (int)'A'; // store the distance, first is the distance to the previous charactor, second is the distance to the next char pair ch_dist[constraint_length]; //index store index from 1 int index[ch_nums] = {}; // try to find the distance for(int i = 0 ; i < s.size() ; i++){ const int word_th = s[i] - first_char; ch_dist[i + 1].first = i + 1 - index[word_th]; if(index[word_th] != 0) ch_dist[index[word_th]].second = i + 1 - index[word_th]; index[word_th] = i + 1; } for(int i = 0 ; i < ch_nums ; i++){ if(index[i]!=0){ ch_dist[index[i]].second = s.size() + 1 - index[i]; // cout<