buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int main() { int k; string s; cin >> k >> s; if (s.length() < k) { cout << s << endl; } else if (s.length() >= k) { rep(i, k) { cout << s[i]; } cout << "..." << endl; } }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int main() { int k; string s; cin >> k >> s; if (s.length() <= k) { cout << s << endl; } else if (s.length() > k) { rep(i, k) { cout << s[i]; } cout << "..." << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47]]
1
89
def ac_168b(K: int, S: str) -> str: if len(S) <= K: return S else: return S[0:K] + "..." K = input() S = input() print(ac_168b(K, S))
def ac_168b(K: int, S: str) -> str: if len(S) <= K: return S else: return S[0:K] + "..." K = int(input()) S = input() print(ac_168b(K, S))
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
56
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) #define ALL(c) (c).begin(), (c).end() #define pb push_back #define eb emplace_back const long long INF = 1LL << 60; // 仮想的な無限大の値; using namespace std; using ll = long long; using P = pair<int, in...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) #define ALL(c) (c).begin(), (c).end() #define pb push_back #define eb emplace_back const long long INF = 1LL << 60; // 仮想的な無限大の値; using namespace std; using ll = long long; using P = pair<int, in...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
198
K = int(input()) S = input() length = len(S) if length <= K: print(S) else: S = S[K:] print(S + "...")
K = int(input()) S = input() length = len(S) if length <= K: print(S) else: S = S[:K] print(S + "...")
[["-", 0, 1, 0, 662, 12, 206, 206, 663, 0, 22], ["+", 0, 1, 0, 662, 12, 206, 206, 663, 0, 22]]
5
45
#include <stdio.h> #include <string.h> int main() { int x; char c[101]; scanf("%d ", &x); scanf("%s", c); int len = strlen(c); if (len <= x) { printf("%s\n", c); } else { for (int i = 0; i < x; i++) { printf("%c\n", c[i]); } printf("...\n"); } return 0; }
#include <stdio.h> #include <string.h> int main() { int x; char c[101]; scanf("%d ", &x); scanf("%s", c); int len = strlen(c); if (len <= x) { printf("%s\n", c); } else { for (int i = 0; i < x; i++) { printf("%c", c[i]); } printf("...\n"); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
107
#include <stdio.h> int main(void) { // Your code here! int N; char S[1000]; scanf("%d", &N); scanf("%s", S); int i; for (i = 0; S[i] != '\0'; ++i) ; if (i < N) printf("%s\n", S); else { for (int j = 0; j < N; j++) printf("%c", S[j]); printf("...\n"); } return 0; }
#include <stdio.h> int main(void) { // Your code here! int N; char S[100]; scanf("%d", &N); scanf("%s", S); int i; for (i = 0; S[i] != '\0'; i++) { } if (i <= N) printf("%s\n", S); else { for (int j = 0; j < N; j++) printf("%c", S[j]); printf("...\n"); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["-", 0, 14, 8, 9, 0, 7, 8, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 8, 9, 0, 57, 15, 23, 0, 16...
0
116
k,s=open(0);k=int(k);print(s[:k]+'...'*(k<len(s)))
k,s=open(0);k=int(k);print(s[:k]+'...'*(k<~-len(s)))
[["+", 12, 657, 12, 23, 0, 666, 0, 664, 17, 92], ["+", 12, 23, 0, 666, 0, 664, 28, 664, 17, 33]]
5
37
k,s=open(0);k=int(k);print(s[:k]+'...'*(k<len(s)))
k,s=open(0);k=int(k);print(s[:k]+'...'*(-~k<len(s)))
[["+", 12, 657, 12, 23, 0, 666, 0, 664, 17, 33], ["+", 12, 23, 0, 666, 0, 664, 28, 664, 17, 92]]
5
37
#include <iostream> #include <string> using namespace std; int main() { int K; string S; cin >> K >> S; if (sizeof(S) <= K) { cout << S << endl; } else { for (int i = 0; i < K; i++) { cout << S.at(i); } cout << "..." << endl; } }
#include <iostream> #include <string> using namespace std; int main() { int K; string S; cin >> K >> S; if (S.size() <= K) { cout << S << endl; } else { for (int i = 0; i < K; i++) { cout << S.at(i); } cout << "..." << endl; } }
[["-", 0, 57, 15, 339, 51, 16, 31, 105, 0, 150], ["-", 15, 339, 51, 16, 31, 105, 51, 23, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24]]
1
79
k = int(input()) s = input() l = len(s) if k > l: print(s) else: print(s[0:k] + "...")
k = int(input()) s = input() l = len(s) if k >= l: print(s) else: print(s[0:k] + "...")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
43
K=int(input()) S=input() if len(S) > K: S = S[:7] S += "..." print(S)
K=int(input()) S=input() if len(S) > K: S = S[:K] S += "..." print(S)
[["-", 0, 1, 0, 662, 12, 206, 206, 663, 0, 612], ["+", 0, 1, 0, 662, 12, 206, 206, 663, 0, 22]]
5
37
a=input() a=int(a) b=input() c="" if a>=len(b): print(b) else: for i in range(a): c=c+b[i] print(c)
a=input() a=int(a) b=input() c="" if a>=len(b): print(b) else: for i in range(a): c=c+b[i] print(c+"...")
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 657, 12, 557, 0, 654], ["+", 0, 652, 3, 4, 0, 657, 12, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 12, 557, 0, 655]]
5
54
#include <bits/stdc++.h> #define ll long long const ll mod = 1000000007; bool isInteger(double n) { if (floor(n) == ceil(n)) return true; return false; } using namespace std; int main() { int k; cin >> k; string s; cin >> s; string s1 = ""; if (s.length() <= k) cout << s; else { for (i...
#include <bits/stdc++.h> #define ll long long const ll mod = 1000000007; bool isInteger(double n) { if (floor(n) == ceil(n)) return true; return false; } using namespace std; int main() { int k; cin >> k; string s; cin >> s; string s1 = ""; if (s.length() <= k) cout << s; else { for (i...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 75, 76, 0, 9, 0, 7, 8, 9, 0, 46], ["-", 75, 76, 0, 1, 0, 11, 12, 103, 0, 104], ["-", 75, 76, 0, 1, 0, 11, 12, 103, 0, 125], ["+", 0, 9, 0, 1, 0, 11, 12, 5, 0, 62], ["+", 0, 9, 0, 1, 0, 11, 12, 5, 0, 6], ["-", 75, 76, 0, 9, 0, 7, 8, 9, 0, 46]]
1
128
#include <stdio.h> int main() { int k; char s[101]; scanf("%d", &k); scanf("%s", s); char ans[101]; int i = 0, needsDot = 0; while (1) { if (s[i] == '\0') { ans[i] = '\0'; break; } if (i < k) { ans[i] = s[i]; } else { ans[i] = '\0'; needsDot = 1; brea...
#include <stdio.h> int main() { int k; char s[101]; scanf("%d", &k); scanf("%s", s); char ans[101]; int i = 0, needsDot = 0; while (1) { if (s[i] == '\0') { ans[i] = '\0'; break; } if (i < k) { ans[i] = s[i]; } else { ans[i] = '\0'; needsDot = 1; brea...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
154
#include <stdio.h> #include <string.h> int main() { int k; char str[105]; scanf("%d", &k); getchar(); scanf("%s", str); // subgoals // 1. cari panjang stringnya // 2. check apakah panjang string sesuai panjang maksimal // jika ya, langsung print stringnya // jika tidak, print sebanyak panjang mak...
#include <stdio.h> #include <string.h> int main() { int k; char str[105]; scanf("%d", &k); getchar(); scanf("%s", str); // subgoals // 1. cari panjang stringnya // 2. check apakah panjang string sesuai panjang maksimal // jika ya, langsung print stringnya // jika tidak, print sebanyak panjang mak...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
117
#include <stdio.h> #include <string.h> int main() { int k; char str[105]; scanf("%d", &k); getchar(); scanf("%s", str); int len = strlen(str); if (len == k) { printf("%s\n", str); } else { for (int i = 0; i < k; i++) { printf("%c", str[i]); } puts("..."); } return 0; }
#include <stdio.h> #include <string.h> int main() { int k; char str[105]; scanf("%d", &k); // getchar(); scanf("%s", &str); int len = strlen(str); if (len <= k) { printf("%s\n", str); } else { for (int i = 0; i < k; i++) { printf("%c", str[i]); } puts("..."); } return 0; }
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
109
K = int(input()) S = input() N = len(S) if K > N: print(S) else: print(S[:K]+'...')
K = int(input()) S = input() N = len(S) if K >= N: print(S) else: print(S[:K]+'...')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
42
def resolve(): K = int(input()) S = input() print(S if len(S) < K else S[:K]+"...") if '__main__' == __name__: resolve()
def resolve(): K = int(input()) S = input() print(S if len(S) <= K else S[:K]+"...") if '__main__' == __name__: resolve()
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 18], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 19]]
5
49
#include <bits/stdc++.h> using namespace std; #define DBG(x) \ (void)(cout << "L" << __LINE__ << ": " << #x << " = " << (x) << '\n') #define Lower_bound(v, x) \ distance(v.begin(), lower_bound(v.beg...
#include <bits/stdc++.h> using namespace std; #define DBG(x) \ (void)(cout << "L" << __LINE__ << ": " << #x << " = " << (x) << '\n') #define Lower_bound(v, x) \ distance(v.begin(), lower_bound(v.beg...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22]]
1
217
K=int(input()) S=input() if len(S) <= K : print(S) else: print(S[:K],'...',end='')
K=int(input()) S=input() if len(S) <= K : print(S) else: print(S[:K]+'...',end='')
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
44
#include <bits/stdc++.h> using namespace std; // type #define ll long long typedef pair<int, int> P; //定数 #define INF 1000000000000 // 10^12:∞ #define MOD 1000000007 // 10^9+7:合同式の法 #define MAXR 100000 // 10^5:配列の最大のrange //略記 #define PB push_back //挿入 #define MP make_pair // pairのコンストラクタ #define F first ...
#include <bits/stdc++.h> using namespace std; // type #define ll long long typedef pair<int, int> P; //定数 #define INF 1000000000000 // 10^12:∞ #define MOD 1000000007 // 10^9+7:合同式の法 #define MAXR 100000 // 10^5:配列の最大のrange //略記 #define PB push_back //挿入 #define MP make_pair // pairのコンストラクタ #define F first ...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
727
n = int(input()) s = input() if len(s) > n: print(s[:n] + '...')
n = int(input()) s = input() if len(s) > n: print(s[:n] + '...') else: print(s)
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102], ["+", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
33
K = input() S = input() LS = len(S) IK = int(K) if LS < IK: print(S) elif LS > IK: print(S[0:IK] + '...')
K = input() S = input() LS = len(S) IK = int(K) if LS <= IK: print(S) elif LS > IK: print(S[0:IK] + '...')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
49
K = int(input()) S = input() print(S[:K]+"..." if len(S) >= K else S)
K = int(input()) S = input() print(S[:K]+"..." if len(S) > K else S)
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 20], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 47]]
5
34
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <numeric> #incl...
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <numeric> #incl...
[["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 57, 75, 76, 0, 1, 0, 16, 17, 151]]
1
1,986
k = int(input()) s = input() print(s if len(s) <= k else s+"...")
k = int(input()) s = input() print(s if len(s) <= k else s[:k] +"...")
[["+", 3, 4, 0, 41, 0, 657, 31, 206, 0, 70], ["+", 0, 41, 0, 657, 31, 206, 206, 663, 0, 102], ["+", 0, 41, 0, 657, 31, 206, 206, 663, 0, 22], ["+", 3, 4, 0, 41, 0, 657, 31, 206, 0, 73]]
5
30
k=int(input()) s=input() print(s if len(s)<=k else s[:7]+'...')
k=int(input()) s=input() print(s if len(s)<=k else s[:k]+'...')
[["-", 0, 41, 0, 657, 31, 206, 206, 663, 0, 612], ["+", 0, 41, 0, 657, 31, 206, 206, 663, 0, 22]]
5
34
K=int(input()) S=input() if len(S)<=K: print(S) else: a=S[:7] a=a+'...' print(a)
K=int(input()) S=input() if len(S)<=K: print(S) else: a=S[:K] a=a+'...' print(a)
[["-", 0, 1, 0, 662, 12, 206, 206, 663, 0, 612], ["+", 0, 1, 0, 662, 12, 206, 206, 663, 0, 22]]
5
45
k = int(input()) s = input() s_list = list(s)#文字列をリストに long = len(s_list) if(long <= k): print(k) else: print(''.join(s_list[:k])+'...')
k = int(input()) s = input() s_list = list(s)#文字列をリストに long = len(s_list) if(long <= k): print(s) else: print(''.join(s_list[:k])+'...')
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
57
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int MOD = 1000000007; int main() { int k; string s; cin >> k >> s; if (s.length() <= k) cout << s << endl; else { rep(i, k) cout << s[i]; } cout << "..." << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int MOD = 1000000007; int main() { int k; string s; cin >> k >> s; if (s.length() <= k) cout << s << endl; else { rep(i, k) cout << s[i]; cout << "..." << endl; } }
[["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
83
def main limit_num = gets.to_i string = gets if string.length > limit_num ans = '' for i in 0..limit_num - 1 ans << string[i] end print(ans+'...') else print(string) end end main
def main limit_num = gets.to_i string = gets.chomp if string.length > limit_num ans = '' for i in 0..limit_num - 1 ans << string[i] end print(ans+'...') else print(string) end end main
[["+", 0, 735, 8, 736, 0, 662, 12, 652, 17, 131], ["+", 0, 735, 8, 736, 0, 662, 12, 652, 735, 22]]
4
51
#include <bits/stdc++.h> #define ll long long int #define mi map<int, int> #define mcr map<char, int> using namespace std; int main() { int k; string s; cin >> k; cin >> s; if (s.size() == k) { cout << s << endl; } else { cout << s.substr(0, k) + "..." << endl; } return 0; }
#include <bits/stdc++.h> #define ll long long int #define mi map<int, int> #define mcr map<char, int> using namespace std; int main() { int k; string s; cin >> k; cin >> s; if (s.size() <= k) { cout << s << endl; } else { cout << s.substr(0, k) + "..." << endl; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
76
#include <bits/stdc++.h> using namespace std; signed main() { int k; string s; cin >> k >> s; if (s.size() < k) cout << s << endl; else cout << s.substr(0, k) << "..." << endl; }
#include <bits/stdc++.h> using namespace std; signed main() { int k; string s; cin >> k >> s; if (s.size() <= k) cout << s << endl; else cout << s.substr(0, k) << "..." << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
58
#include <bits/stdc++.h> #define all(x) begin(x), end(x) #define rep(i, n) for (u64 i = 0; i < (u64)n; ++i) typedef signed int s32; typedef unsigned int u32; typedef float f32; typedef signed long long s64; typedef unsigned long long u64; typedef double f64; using namespace std; using str = string; template <typename...
#include <bits/stdc++.h> #define all(x) begin(x), end(x) #define rep(i, n) for (u64 i = 0; i < (u64)n; ++i) typedef signed int s32; typedef unsigned int u32; typedef float f32; typedef signed long long s64; typedef unsigned long long u64; typedef double f64; using namespace std; using str = string; template <typename...
[["-", 64, 1, 0, 11, 12, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 11, 12, 16, 12, 5, 0, 6]]
1
204
#include <stdio.h> #include <string.h> int main() { int e, d; char s[101]; char c[101]; scanf("%d", &e); scanf("%s", s); d = strlen(s); // d++; strncpy(c, s, e); c[e] = '\0'; if (d >= e) printf("%s...\n", c); else printf("%s\n", s); return 0; }
#include <stdio.h> #include <string.h> int main() { int e, d; char s[101]; char c[101]; scanf("%d", &e); scanf("%s", s); d = strlen(s); // d++; strncpy(c, s, e); c[e] = '\0'; if (d > e) printf("%s...\n", c); else printf("%s\n", s); return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47]]
0
102
#include <iostream> #include <string> using namespace std; int main() { int k; cin >> k; string s; cin >> s; int n = s.size(); if (n < k) { cout << s; } else { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..."; } }
#include <iostream> #include <string> using namespace std; int main() { int k; cin >> k; string s; cin >> s; int n = s.size(); if (n <= k) { cout << s; } else { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..."; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
81
#include <bits/stdc++.h> using namespace std; int main() { int K; string S; cin >> K >> S; if (S.size() <= K) cout << S; else { for (int i = 0; i < K; i++) { cout << S.at(i); } } }
#include <bits/stdc++.h> using namespace std; int main() { int K; string S; cin >> K >> S; if (S.size() <= K) cout << S; else { for (int i = 0; i < K; i++) { cout << S.at(i); } cout << "..."; } }
[["+", 75, 76, 0, 9, 0, 1, 0, 16, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
66
K = int(input()) S = input() if len(S) < K: print(S) else: print(S[:K]+'...')
K = int(input()) S = input() if len(S) <= K: print(S) else: print(S[:K]+'...')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
39
#include <bits/stdc++.h> using namespace std; int main() { int a, m; string s, s2, s3; cin >> a; cin >> s; m = s.length(); if (m >= a) { for (int i = 0; i < a; i++) { char c = s[i]; s2.push_back(c); } s3 = s2 + "..."; cout << s3 << endl; return 0; } else { cout << s << ...
#include <bits/stdc++.h> using namespace std; int main() { int a, m; string s, s2, s3; cin >> a; cin >> s; m = s.length(); if (m > a) { for (int i = 0; i < a; i++) { char c = s[i]; s2.push_back(c); } s3 = s2 + "..."; cout << s3 << endl; return 0; } else { cout << s << e...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
108
#include <iostream> #include <string> using namespace std; int main() { string S; unsigned int K; cin >> K; cin >> S; if (K < S.length()) { cout << S.substr(0, K + 1) + "..." << endl; } else { cout << S << endl; } }
#include <iostream> #include <string> using namespace std; int main() { string S; int K; cin >> K; cin >> S; if (K < S.length()) { cout << S.substr(0, K) + "..." << endl; } else { cout << S << endl; } }
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["-", 12, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["-", 12, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
69
k = int(input()) s = input() if len(s) >= k: print(s[:k], '...', sep='') else: print(s)
k = int(input()) s = input() if len(s) > k: print(s[:k], '...', sep='') else: print(s)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
44
#include <iostream> #include <string.h> using namespace std; int main() { int k; string s; cin >> k >> s; int n = s.size(); if (n == k) cout << s; else cout << s.substr(0, k) << "..."; return 0; }
#include <iostream> #include <string.h> using namespace std; int main() { int k; string s; cin >> k >> s; int n = s.size(); if (k >= n) cout << s; else cout << s.substr(0, k) << "..."; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
64
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int k = sc.nextInt(); String s = sc.next(); int s_length = s.length(); String dots = "..."; String ans = ""; if (k > s_length) { S...
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int k = sc.nextInt(); String s = sc.next(); int s_length = s.length(); String dots = "..."; String ans = ""; if (k >= s_length) { ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20]]
3
131
k = int(input()) s = str(input()) if k > len(s): print(s) else: print(s[:k] + "...")
k = int(input()) s = str(input()) if k >= len(s): print(s) else: print(s[:k] + "...")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
42
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int k; char s[100]; int i; int slen; scanf("%d %s", &k, s); slen = strlen(s); if (slen < k) printf("%s", s); else { for (i = 0; i < k; i++) { printf("%c", s[i]); } printf("..."); } return 0; }
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int k; char s[100]; int i; int slen; scanf("%d %s", &k, s); slen = strlen(s); if (slen <= k) printf("%s", s); else { for (i = 0; i < k; i++) { printf("%c", s[i]); } printf("..."); } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
101
function Main(input) { input = input.trim().split('\n'); var K = input[0]; var S = input[1]; var ans = ''; if (S.length <= K) { ans = S; } else { ans = S.slice(0, 7) + '...'; } console.log(ans); } Main(require("fs").readFileSync("/dev/stdin", "utf8"));
function Main(input) { input = input.trim().split('\n'); var K = input[0]; var S = input[1]; var ans = ''; if (S.length <= K) { ans = S; } else { ans = S.slice(0, K) + '...'; } console.log(ans); } Main(require("fs").readFileSync("/dev/stdin", "utf8"));
[["-", 0, 11, 12, 16, 31, 2, 3, 3, 0, 555], ["+", 0, 11, 12, 16, 31, 2, 3, 3, 0, 22]]
2
104
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k >> s; int len = s.size(); if (len >= k) { s.erase(k); s.append("..."); } cout << s << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k >> s; int len = s.size(); if (len > k) { s.erase(k); s.append("..."); } cout << s << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
63
// ABC168B.cpp : このファイルには 'main' // 関数が含まれています。プログラム実行の開始と終了がそこで行われます。 // //#include "pch.h" #include <iostream> #include <string> using namespace std; int main() { int K; cin >> K; string S; cin >> S; if (S.size() < K) { cout << S << endl; } else { cout << S.substr(0, K) + "..." << endl; } }
// ABC168B.cpp : このファイルには 'main' // 関数が含まれています。プログラム実行の開始と終了がそこで行われます。 //#include "pch.h" #include <iostream> #include <string> using namespace std; int main() { int K; cin >> K; string S; cin >> S; if (S.size() <= K) { cout << S << endl; } else { cout << S.substr(0, K) + "..." << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
70
#include <bits/stdc++.h> #include <iostream> using namespace std; int main(void) { int k; cin >> k; string s; getline(cin, s); getline(cin, s); if (s.length() < k) { cout << s; } else { cout << s.substr(0, k) << "..."; } }
#include <bits/stdc++.h> #include <iostream> using namespace std; int main(void) { int k; cin >> k; string s; getline(cin, s); getline(cin, s); if (s.length() <= k) { cout << s; } else { cout << s.substr(0, k) << "..."; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
73
#include <bits/stdc++.h> using namespace std; int main() { int K, N; string S, A; cin >> K >> S; N = S.size(); if (N <= K) { cout << S << endl; } else { for (int i = 0; i + 1 < N - K; i++) { A = A + S.at(i); } A = A + "..."; } cout << A << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int K, N; string S, A; cin >> K >> S; N = S.size(); if (N <= K) { cout << S << endl; } else { for (int i = 0; i < K; i++) { A = A + S.at(i); } A = A + "..."; } cout << A << endl; }
[["-", 0, 9, 0, 7, 15, 16, 31, 16, 17, 72], ["-", 0, 9, 0, 7, 15, 16, 31, 16, 12, 13], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 17, 33]]
1
98
import java.io.*; import java.math.*; import java.util.*; public class Main { public static void process() throws IOException { int k = ni(); String s = nln(); if (s.length() > k) pn(s); else pn(s.substring(0, k) + "..."); } static FastReader sc; static PrintWriter out; public st...
import java.io.*; import java.math.*; import java.util.*; public class Main { public static void process() throws IOException { int k = ni(); String s = nln(); if (s.length() <= k) pn(s); else pn(s.substring(0, k) + "..."); } static FastReader sc; static PrintWriter out; public s...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19]]
3
608
#include <bits/stdc++.h> using namespace std; int main() { int K; string S; cin >> K >> S; if (S.size() <= K) { cout << S; } else { for (int i = 0; i <= K; i++) { cout << S.at(i); } cout << "..."; } }
#include <bits/stdc++.h> using namespace std; int main() { int K; string S; cin >> K >> S; if (S.size() <= K) { cout << S; } else { for (int i = 0; i < K; i++) { cout << S[i]; } cout << "..."; } }
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 19], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 1, 0, 16, 12, 2, 63, 118, 17, 131], ["-", 0, 1, 0, 16, 12, 2, 63, 118, 119, 120], ["-", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25], ["+", 0, 1, 0, 16...
1
74
n=int(input()) s=input() while len(s)<n: s=s[:n]+"..." print(s)
n=int(input()) s=input() if len(s)>n: s=s[:n]+"..." print(s)
[["-", 36, 36, 36, 36, 0, 656, 0, 52, 0, 89], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
36
#include <bits/stdc++.h> using namespace std; // types typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef pair<int, int> pii; // IO #define fo(i, n) for (int i = 0; i < n; i++) #define fo1(i, n) for (int i = 1; i <= n; i++) #define sc(n) scanf("%d", &n) #define sca(a, n) fo(i, n) sc(a...
#include <bits/stdc++.h> using namespace std; // types typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef pair<int, int> pii; // IO #define fo(i, n) for (int i = 0; i < n; i++) #define fo1(i, n) for (int i = 1; i <= n; i++) #define sc(n) scanf("%d", &n) #define sca(a, n) fo(i, n) sc(a...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
373
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 110 void main() { int k; char s[N], s_[N]; if (scanf("%d", &k) < 1) exit(1); if (scanf("%s", s) < 1) exit(1); if (strlen(s) > k) { strncpy(s_, s, k); s_[k] = '\0'; strcat(s_, "..."); printf("%s %d", s_); } else {...
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 110 void main() { int k; char s[N], s_[N]; if (scanf("%d", &k) < 1) exit(1); if (scanf("%s", s) < 1) exit(1); if (strlen(s) > k) { strncpy(s_, s, k); s_[k] = '\0'; strcat(s_, "..."); printf("%s", s_); } else { ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
125
package main import "fmt" func main() { var k int var s string fmt.Scan(&k) fmt.Scan(&s) if len(s) <= k { fmt.Println(s) } else { fmt.Println(s[0:len(s)] + "...") } }
package main import "fmt" func main() { var k int var s string fmt.Scan(&k) fmt.Scan(&s) if len(s) <= k { fmt.Println(s) } else { fmt.Println(s[0:k] + "...") } }
[["-", 3, 4, 0, 16, 31, 443, 444, 2, 63, 22], ["-", 0, 16, 31, 443, 444, 2, 3, 4, 0, 24], ["-", 0, 16, 31, 443, 444, 2, 3, 4, 0, 22], ["-", 0, 16, 31, 443, 444, 2, 3, 4, 0, 25], ["+", 0, 2, 3, 4, 0, 16, 31, 443, 444, 22]]
7
77
package main import "fmt" func main() { var s string var k int fmt.Scanf("%d", &k) fmt.Scanf("%s", &s) if len(s) > k { fmt.Printf("%s...", s[:k+1]) } else { fmt.Printf("%s", s) } }
package main import "fmt" func main() { var s string var k int fmt.Scanf("%d", &k) fmt.Scanf("%s", &s) if len(s) > k { fmt.Printf("%s...", s[:k]) } else { fmt.Printf("%s", s) } }
[["-", 36, 36, 0, 434, 0, 435, 8, 196, 0, 165], ["+", 36, 36, 0, 434, 0, 435, 8, 196, 0, 165], ["-", 0, 2, 3, 4, 0, 443, 444, 16, 17, 72], ["-", 0, 2, 3, 4, 0, 443, 444, 16, 12, 433]]
7
88
K = int(input()) S = input() print(S if (len(S) > K) else (S[:K] + "..."))
K = int(input()) S = input() print(S if (len(S) <= K) else (S[:K] + "..."))
[["-", 3, 4, 0, 41, 0, 23, 0, 666, 667, 47], ["+", 3, 4, 0, 41, 0, 23, 0, 666, 667, 19]]
5
38
k = int(input()) s = input() if len(s) < k : print(s) else : tmp = s[0:k] + "..." print(tmp)
k = int(input()) s = input() if len(s) <= k : print(s) else : tmp = s[0:k] + "..." print(tmp)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
43
import numpy as np K = int(input()) S = input() if len(S) < K: print(S) else: print(S[:K] + "...")
import numpy as np K = int(input()) S = input() if len(S) <= K: print(S) else: print(S[:K] + "...")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
43
#include <iostream> #include <string> using namespace std; int main() { string s; int k; cin >> s >> k; if (s.size() > k) cout << s.substr(0, k) << "..." << endl; else cout << s << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main() { string s; int k; cin >> k >> s; if (s.size() > k) cout << s.substr(0, k) << "..." << endl; else cout << s << endl; return 0; }
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
63
k=int(input()) s=input() l=len(s) if l<=k: print(s) else: print(s[:k-1]+"...")
k=int(input()) s=input() l=len(s) if l<=k: print(s) else: print(s[:k]+"...")
[["-", 0, 657, 31, 206, 206, 663, 0, 657, 17, 33], ["-", 0, 657, 31, 206, 206, 663, 0, 657, 12, 612]]
5
44
#include <bits/stdc++.h> using namespace std; template <typename T> void out(T x) { cout << x << endl; exit(0); } #define watch(x) cout << (#x) << " is " << (x) << endl typedef long long ll; const ll mod = 1e9 + 7; const int maxn = 1e6 + 5; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.ti...
#include <bits/stdc++.h> using namespace std; template <typename T> void out(T x) { cout << x << endl; exit(0); } #define watch(x) cout << (#x) << " is " << (x) << endl typedef long long ll; const ll mod = 1e9 + 7; const int maxn = 1e6 + 5; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.ti...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
137
#include <bits/stdc++.h> #define booga cout << "booga" << endl #define ll long long int /* run this program using the console pauser or add your own getch, * system("pause") or input loop */ using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; int k; cin >> s >> k; if (s.si...
#include <bits/stdc++.h> #define booga cout << "booga" << endl #define ll long long int /* run this program using the console pauser or add your own getch, * system("pause") or input loop */ using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; int k; cin >> k >> s; if (s.si...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
82
#include <iostream> #include <string> using namespace std; int main() { int K; cin >> K; string S; cin >> S; if ((int)S.size() < K) cout << S; else cout << S.substr(0, K) << "..."; return 0; }
#include <iostream> #include <string> using namespace std; int main() { int K; cin >> K; string S; cin >> S; if ((int)S.size() <= K) cout << S; else cout << S.substr(0, K) << "..."; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
64
k = int(input()) s = input() slist = list(s) if len(slist) > k: l = '' for i in range(k): l += slist[i] print('...' + l) else: print(s)
k = int(input()) s = input() slist = list(s) if len(slist) > k: l = '' for i in range(k): l += slist[i] print(l + '...') else: print(s)
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
59
import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int K = Integer.parseInt(reader.readLine()); String S = reader.readLine(); if (S.length() < K) System.out.println...
import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int K = Integer.parseInt(reader.readLine()); String S = reader.readLine(); if (S.length() <= K) System.out.printl...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19]]
3
106
k=input() n=input() m=len(n) t=int (k) if(m<=t): print("n") else: for i, name in enumerate(n): if i==t: break print(name,end='')
k=input() n=input() m=len(n) t=int (k) if(m<=t): print(n) else: for i, name in enumerate(n): if i==t: print("...") break print(name,end='')
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 64, 196, 0, ...
5
62
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); Integer number = scanner.nextInt(); String string = scanner.next(); int wordCount = string.length(); if (number <= wordCount) { String cuttingWord = string.subs...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); Integer number = scanner.nextInt(); String string = scanner.next(); int wordCount = string.length(); if (number < wordCount) { String cuttingWord = string.subst...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18]]
3
109
k,s=open(0) k = int(k) print(s[:k]+'...'*(len(s)>k))
k, s = open(0) k = int(k) print(s[:k] + '...'*(len(s)-1>k))
[["+", 12, 657, 12, 23, 0, 666, 0, 657, 17, 33], ["+", 12, 657, 12, 23, 0, 666, 0, 657, 12, 612]]
5
35
#include <iostream> #include <string> using namespace std; int main() { string str; int K; int str_size; cin >> K; cin >> str; str_size = str.length(); if (str_size <= K) { cout << str; return 0; } else { cout << str.substr(0, 7) << "..."; return 0; } return 0; }
#include <iostream> #include <string> using namespace std; int main() { string str; int K; int str_size; cin >> K; cin >> str; str_size = str.length(); if (str_size <= K) { cout << str; return 0; } else { cout << str.substr(0, K) << "..."; return 0; } return 0; }
[["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22]]
1
78
k=int(input()) s=input() print(s[:k] + (len(s)-k)*'.')
k=int(input()) s=input() print(s[:k] + (len(s)>k)*'...')
[["-", 0, 657, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 657, 12, 657, 31, 23, 0, 666, 667, 47], ["-", 3, 4, 0, 657, 12, 657, 12, 557, 0, 6], ["+", 3, 4, 0, 657, 12, 657, 12, 557, 0, 6]]
5
34
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k >> s; if (s.size() <= k) { cout << s << endl; } else { for (int i = 0; i < 7; i++) { cout << s[i]; } cout << "..." << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k >> s; if (s.size() <= k) { cout << s << endl; } else { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..." << endl; } return 0; }
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22]]
1
79
K = int(input()) S = input() a = len(S) if a < K: print(S) else: print(S[:K] + ("..."))
K = int(input()) S = input() a = len(S) if a <= K: print(S) else: print(S[:K] + ("..."))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
44
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int K = sc.nextInt(); String S = sc.next(); sc.close(); if (K > S.length()) { System.out.println(S); } else { System.out.println(S.substring(0, K) + "..."); } ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int K = sc.nextInt(); String S = sc.next(); sc.close(); if (K >= S.length()) { System.out.println(S); } else { System.out.println(S.substring(0, K) + "..."); }...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20]]
3
103
k = gets.to_i s = gets output = s if s.length > k output = s[..k-1] + '...' end puts output
k = gets.to_i s = gets.chomp output = s if s.length > k output = s[..k-1] + "..." end puts output
[["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["-", 64, 749, 0, 662, 12, 738, 12, 557, 0, 62], ["+", 64, 749, 0, 662, 12, 738, 12, 557, 0, 62]]
4
33
#include <ciso646> #include <cmath> #include <cstring> #include <iostream> #include <string> using namespace std; int main() { /*一日目*/ int k; cin >> k; char s[101]; cin >> s; string s1 = "..."; if (strlen(s) < k) cout << s; else if (strlen(s) > k) { for (int i = 0; i < k; i++) cout << s[i]; ...
#include <ciso646> #include <cmath> #include <cstring> #include <iostream> #include <string> using namespace std; int main() { /*一日目*/ int k; cin >> k; char s[101]; cin >> s; string s1 = "..."; if (strlen(s) <= k) cout << s; else if (strlen(s) > k) { for (int i = 0; i < k; i++) cout << s[i];...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
95
K=int(input()) S=input() S_len=len(S) three_point='...' if S_len<K: print(S) else: print(S[0:K]+three_point)
K=int(input()) S=input() S_len=len(S) three_point='...' if S_len<=K: print(S) else: print(S[0:K]+three_point)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
46
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> using namespace std; #define ll long long int int main() { ll x; cin >> x; string str; cin >> str; if (str.size() >= x) { for (ll i = 0; i < str.size(); i++) { if (i < x) cout << str[i]; } ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> using namespace std; #define ll long long int int main() { ll x; cin >> x; string str; cin >> str; if (str.size() > x) { for (ll i = 0; i < str.size(); i++) { if (i < x) cout << str[i]; } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
96
#include <bits/stdc++.h> using namespace std; typedef long long int ll; void solve() { int k; cin >> k; string s; cin >> s; if (s.size() <= k) cout << s << "\n"; else cout << s.substr(0, k) << "\n"; } int main() { int t = 1; // cin >> t; while (t--) { solve(); } return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; void solve() { int k; cin >> k; string s; cin >> s; if (s.size() <= k) cout << s << "\n"; else cout << s.substr(0, k) << "...\n"; } int main() { int t = 1; // cin >> t; while (t--) { solve(); } return 0; }
[["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
92
K = int(input()) S = str(input()) if len(S) <= K: print(S) else: print(S[K:]+"...")
K = int(input()) S = str(input()) if len(S) <= K: print(S) else: print(S[:K]+"...")
[["-", 3, 4, 0, 657, 31, 206, 206, 663, 0, 22], ["+", 3, 4, 0, 657, 31, 206, 206, 663, 0, 22]]
5
42
// Bismillahir Rahmanir Rahim #include <bits/stdc++.h> using namespace std; int main() { int k, l; string s; cin >> k >> s; l = s.length(); if (k == l) { cout << s << endl; } else if (k < l) { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "...\n"; } return 0; }
// Bismillahir Rahmanir Rahim #include <bits/stdc++.h> using namespace std; int main() { int k, l; string s; cin >> k >> s; l = s.length(); // cout<<l<<endl; if (k >= l) { cout << s << endl; } else if (k < l) { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "...\n"; } retu...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
91
#include <algorithm> #include <cmath> #include <iostream> #include <set> #include <string> #include <vector> using namespace std; int main() { int k; string s; cin >> k >> s; int n = s.length(); if (n <= k) cout << s; else { for (int i = 0; i < n - k - 1; ++i) { cout << s[i]; } cout <<...
#include <algorithm> #include <cmath> #include <iostream> #include <set> #include <string> #include <vector> using namespace std; int main() { int k; string s; cin >> k >> s; int n = s.length(); if (n <= k) cout << s; else { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..."; ...
[["-", 0, 7, 15, 16, 12, 16, 31, 16, 31, 22], ["-", 0, 7, 15, 16, 12, 16, 31, 16, 17, 33], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 75, 76, 0, 9, 0, 7, 26, 27, 17, 29], ["+", 75, 76, 0, 9, 0, 7, 26, 27, 17, 29]]
1
92
K=int(input()) S=str(input()) if K>=len(S): print(S) else: print(S[:K],"...")
K=int(input()) S=str(input()) if K>=len(S): print(S) else: print(S[:K]+"...")
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
42
K = int(input()) S = input() if len(S) >= K: print(S) else: print(S[:K]+'...')
K = int(input()) S = input() if len(S) <= K: print(S) else: print(S[0:K]+'...')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 3, 4, 0, 657, 31, 206, 206, 663, 0, 612]]
5
39
n=int(input()) s=input() if len(s)>n: nl=s[0:n] print(nl,'...') else: print(s)
n=int(input()) s=input() if len(s)>n: nl=s[0:n] print(nl+'...') else: print(s)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
43
#include <algorithm> #include <iostream> #include <math.h> #include <string> #include <utility> #include <vector> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int x, y; string s; cin >> x >> s; y = s.size(); if (x > y) { for (int i = 0; i < y; i++) { cout << s[i];...
#include <algorithm> #include <iostream> #include <math.h> #include <string> #include <utility> #include <vector> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int x, y; string s; cin >> x >> s; y = s.size(); if (y > x) { for (int i = 0; i < x; i++) { cout << s[i];...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22]]
1
102
abc166b k=int(input()) s=input() if len(s)<=k: print(s) else: ss=s[:k] print(ss+'...')
#abc168b k=int(input()) s=input() if len(s)<=k: print(s) else: ss=s[:k] print(ss+'...')
[["-", 36, 36, 36, 36, 0, 656, 0, 1, 0, 22]]
5
43
#include <stdio.h> int main(void) { int K, i, j; char S[100]; scanf("%d %s", &K, S); for (i = 0; S[i] != '\0'; i++) ; if (i + 1 >= K) { for (j = 0; j != K; j++) { printf("%c", S[j]); } printf("...\n"); } else { printf("%s\n", S); } return 0; }
#include <stdio.h> int main(void) { int K, i, j; char S[100]; scanf("%d %s", &K, S); for (i = 0; S[i] != '\0'; i++) ; if (i > K) { for (j = 0; j != K; j++) { printf("%c", S[j]); } printf("...\n"); } else { printf("%s\n", S); } return 0; }
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 72], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47]]
0
114
k = int(input()) s = input() if len(s) <= k: print(s) else: print("{}...".format(s[0:7]))
k = int(input()) s = input() if len(s) <= k: print(s) else: print("{}...".format(s[0:k]))
[["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
43
import sys import os import math import bisect import collections import itertools import heapq import re import queue # import fractions ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: list(map(int, sys.stdin.buffer.readline().split())) fl = lambda: list(map(float, sys.stdin.buffer.readline().spl...
import sys import os import math import bisect import collections import itertools import heapq import re import queue # import fractions ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: list(map(int, sys.stdin.buffer.readline().split())) fl = lambda: list(map(float, sys.stdin.buffer.readline().spl...
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20]]
5
318
#include <iostream> #include <string> using namespace std; int main() { int N, size; string s; cin >> N; cin >> s; size = s.length(); /*cout << size << endl;*/ if (size < N) { cout << s << endl; } else { cout << s.substr(0, N) + "..." << endl; } }
#include <iostream> #include <string> using namespace std; int main() { int N, size; string s; cin >> N; cin >> s; size = s.length(); /*cout << size << endl;*/ if (size <= N) { cout << s << endl; } else { cout << s.substr(0, N) + "..." << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
73
#include <bits/stdc++.h> // Useful constants #define INF (int)1e9 #define EPS 1e-9 #define MOD 1000000007ll #define PI 3.14159 // for input-output #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(N...
#include <bits/stdc++.h> // Useful constants #define INF (int)1e9 #define EPS 1e-9 #define MOD 1000000007ll #define PI 3.14159 // for input-output #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(N...
[["-", 0, 1, 0, 16, 31, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 16, 31, 2, 3, 4, 0, 13], ["-", 3, 4, 0, 16, 31, 2, 63, 118, 28, 22], ["-", 3, 4, 0, 16, 31, 2, 63, 118, 17, 131], ["-", 3, 4, 0, 16, 31, 2, 63, 118, 119, 120], ["-", 3, 4, 0, 16, 31, 2, 3, 4, 0, 24], ["-", 3, 4, 0, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 16, 31, 2, 3, 4...
1
459
#include <bits/stdc++.h> #define ll long long #define pi acos(-1.0) #define pb push_back #define vi vector<int> #define mapii map<int, int> #define mapci map<char, int> #define mapsi map<string, int> #define FOR(i, n) for (int i = 0; i < n; i++) #define CP(n) cout << "Case " << n << ": " #define fr freopen("input.txt",...
#include <bits/stdc++.h> #define ll long long #define pi acos(-1.0) #define pb push_back #define vi vector<int> #define mapii map<int, int> #define mapci map<char, int> #define mapsi map<string, int> #define FOR(i, n) for (int i = 0; i < n; i++) #define CP(n) cout << "Case " << n << ": " #define fr freopen("input.txt",...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
131
try: k=int(input()) s=input() if(len(s)<=k): print(s) else: ans='' ans=s[:7]+'...' print(ans) except EOFError as e: pass
try: k=int(input()) s=input() if(len(s)<=k): print(s) else: ans='' ans=s[:k]+'...' print(ans) except EOFError as e: pass
[["-", 0, 662, 12, 657, 31, 206, 206, 663, 0, 612], ["+", 0, 662, 12, 657, 31, 206, 206, 663, 0, 22]]
5
56
k = int(input()) s = input() if len(s) > k: print(s[:k+1]+'...') else: print(s)
k = int(input()) s = input() if len(s) > k: print(s[:k]+'...') else: print(s)
[["-", 0, 657, 31, 206, 206, 663, 0, 657, 17, 72], ["-", 0, 657, 31, 206, 206, 663, 0, 657, 12, 612]]
5
41
#include <bits/stdc++.h> #define AC \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define ll long long #define for0 \ for (i = 0; ...
#include <bits/stdc++.h> #define AC \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define ll long long #define for0 \ for (i = 0; ...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 107], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 9, 0, 1, 0, 11, 12, 5, 0, 62], ["+", 0, 9, 0, 1, 0, 11, 12, 5, 0, 6], ["-", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22]]
1
187
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int k; string s; cin >> k >> s; if (s.length() > k) { string output = s.substr(0, k); cout << output; } else { cout << s; } return 0; }
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int k; string s; cin >> k >> s; if (s.length() > k) { string output = s.substr(0, k); cout << output << "..."; } else { cout << s; } return 0; }
[["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
66
#include <iostream> #include <string> using namespace std; /*define*/ string S; int K; int N; int main() { /*inpus*/ std::cin >> K; std::cin >> S; /*syori*/ N = S.length(); if (N > K) { S = S.substr(0, 100) + "..."; } std::cout << S; }
#include <iostream> #include <string> using namespace std; /*define*/ string S; int K; int N; int main() { /*inpus*/ std::cin >> K; std::cin >> S; /*syori*/ N = S.length(); if (N > K) { S = S.substr(0, K) + "..."; } std::cout << S; }
[["-", 0, 11, 12, 16, 31, 2, 3, 4, 0, 13], ["+", 0, 11, 12, 16, 31, 2, 3, 4, 0, 22]]
1
75
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int k = Integer.parseInt(in.readLine()); String input = in...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int k = Integer.parseInt(in.readLine()); String input = in...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18]]
3
122