B. 最长无重复字符子串的长度
维护一个不含重复字符的子串。每次子串右边界加入一个字符,若原子串中已经含有这个字符,向右移动左边界,直至重复字符离开子串。每次操作后更新maxx。不断重复该操作。
#include <iostream> using namespace std; char s[1000]; int cnt[1000]; int main(){ cin>>s; int l=0,r=0,len,maxx=0; while(r<strlen(s)){ cnt[s[r]]++; while(s[r]!='