「0123456789 ?」を含む文字列があります。私はしたいと思います
- if first char is not ' ' or '?' and the rest is " ", return the first char
- if last char is not ' ' or '?' and the rest is " ", return the last char
- if the string is only " ", return -1
- and else, return -2
いくつかの解決策を見つけましたが、速度と優れたコーディングの点で満足できるものはありませんでした。素敵でエレガントな解決策を考えている人は、それを私に共有できますか?!
ありがとうございました