@Anirban Chand scan left to right and apply maximal munch. check here
your question is discussed in Prof. Alex Aiken's compiler course but I am not getting the link now.
@ankitgupta.1729
then here token are
x
++
+
y
5 tokens
rt?
64.3k questions
77.9k answers
244k comments
80.0k users