How to tackle different sample size in the training set in SVM
A SVM classifier requires a fixed-length feature vector, i.e., all feature vectors must have the same length.  There are multiple solutions:


Pad out the strings to fixed length.
Choose a different set of features, so that there is a fixed number of features.
Pick a fixed number $k$, and look at windows of length $k$ (i.e., substrings of length $k$).  Classify each window of length $k$ using your SVM, then combine those results somehow (e.g., majority vote).
Use a different classifier, such as a recurrent neural network (e.g., LSTM).  See also https://datascience.stackexchange.com/q/16115/8560 for more possibilities.


It's hard to say what will be most appropriate for your particular situation, without knowing more about your learning task.



Based on your subsequent comments, it sounds like you want to learn a DFA.  There's lots written on learning DFAs, using Angluin's algorithm, SAT solvers, or other methods.  Follow the link above for some entry points into the literature on that.  I don't think a SVM  is the right tool for that job -- this sounds like an XY problem.