Coding Test - cpp/String
[백준 11721: 열 개씩 끊어 출력하기] - C++
에드윈H
2021. 3. 25. 18:10
11721번: 열 개씩 끊어 출력하기
첫째 줄에 단어가 주어진다. 단어는 알파벳 소문자와 대문자로만 이루어져 있으며, 길이는 100을 넘지 않는다. 길이가 0인 단어는 주어지지 않는다.
www.acmicpc.net
#pragma once
#include <iostream>
#include <string>
using namespace std;
int main() {
string n;
cin >> n;
int cnt = 1;
for (int i = 0; i < n.size(); i++)
{
if (cnt % 11 != 0)
{
cout << n[i];
}
else {
cout << "\n";
cnt = 0;
i--;
}
cnt++;
}
return 0;
}//end of main