Way Too Long Words Codeforces solution in C++ is 100% Accepted.
Popular online venue Codeforces hosts fiercely competitive design contests. It helps programmers develop their problem-solving abilities by offering algorithmic tasks for them to solve. The section in way too long words codeforces solution in c labeled “Way Too Long Words” is one issue. We will look at the CPP solution to this issue in this article.
Codeforces -71A. Way Too Long Words question link
Understanding the issue
The unsettling message in “Way Too Long Words” is simple. It necessitates that we reduce terms that may be overly long due to specific circumstances. The entry consists of an integer ‘n’ followed by ‘n’ words. If the period of a word exceeds 10 characters, we want to update it with a new string that comprises the initial letter, the number of letters between the first and last letters (different), and the last letter.
Codeforces Solution in C++
#include<iostream> #include<string> using namespace std; int main() { int n; string s; cin>>n; for (int i=0;i>s; int b=s.length(); if(b>10) { cout<<s[0]<<b-2<<s[b-2]<<endl;//Way too long words solution } else { cout<<s<<endl; } } return 0; }
Codeforces solution in C
#include<stdio.h>
#include<string.h>
int main() {
int n;
char s[100]; // Assuming max length of the string is 100
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%s", s);
int b = strlen(s);
if (b > 10) {
printf("%c%d%c\n", s[0], b-2, s[b-1]); // Way too long words Codeforces solution in C
} else {
printf("%s\n", s);
}
}
return 0;
}
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Your article helped me a lot, is there any more related content? Thanks!
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.