Official
B - 分離/Separation Editorial
by
B - 分離/Separation Editorial
by
sounansya
空文字列を \(2\) つ用意し、\(S\) の先頭の文字から順番に見ていき大文字から一方へ、小文字ならもう一方へ連結する操作を繰り返すと求める \(2\) つの文字列を得ることができます。
実装例(Python3)
s = input()
ans1 = ""
ans2 = ""
for c in s:
if c.isupper():
ans1 += c
else:
ans2 += c
print(ans1)
print(ans2)
posted:
last update:
