Implement a function that takes a single input string encoding N daily OHLC price records in the format "o1,h1,l1,c1;o2,h2,l2,c2;...;oN,hN,lN,cN" (semicolon-separated records, comma-separated fields). Return one output string of length N where the i-th character classifies the i-th candle: 'B' if ci > oi, 'S' if ci < oi, 'D' if ci == oi. A record is invalid if hi < max(oi,ci) or li > min(oi,ci), or if any field is missing or not a valid number; for invalid records output 'X' in that position. N can be up to 200,000; parse in one pass in O(total input length) time and O(