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
<?php $a=trim(fgets(STDIN)); $b=trim(fgets(STDIN)); if($a<=strlen($b)){ echo $b; }else{ echo substr($b,0,$a)."..."; }
<?php $a=trim(fgets(STDIN)); $b=trim(fgets(STDIN)); if($a>=strlen($b)){ echo $b; }else{ echo substr($b,0,$a)."..."; }
[["-", 0, 493, 0, 57, 15, 23, 0, 16, 17, 19], ["+", 0, 493, 0, 57, 15, 23, 0, 16, 17, 20]]
6
59
#include <iostream> #include <string> int main() { int k; std::string s; std::cin >> k >> s; if (s.size() <= k) { std::cout << s << std::endl; } else { for (int i = 0; i < k; i++) std::cout << s[i] + "..." << std::endl; } }
#include <iostream> #include <string> int main() { int k; std::string s; std::cin >> k >> s; if (s.size() <= k) { std::cout << s << std::endl; } else { for (int i = 0; i < k; i++) std::cout << s[i]; std::cout << "..." << std::endl; } }
[["-", 8, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 75, 76, 0, 9, 0, 7, 8, 1, 0, 35], ["+", 0, 1, 0, 16, 31, 16, 31, 343, 345, 348], ["+", 0, 1, 0, 16, 31, 16, 31, 343, 0, 349], ["+", 0, 1, 0, 16, 31, 16, 31, 343, 141, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 17, 151]]
1
82
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); int k = Integer.parseInt(br.readLine()); ...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); int k = Integer.parseInt(br.readLine()); ...
[["-", 0, 57, 64, 196, 0, 1, 0, 492, 141, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 492, 141, 22]]
3
137
/* package whatever; // don't place package name! */ import java.io.*; import java.lang.*; import java.util.*; /* Name of the class has to be "Main" only if the class is public. */ public final class Main { public static void main(String[] args) throws java.lang.Exception { // your code goes here Scanner s ...
/* package whatever; // don't place package name! */ import java.io.*; import java.lang.*; import java.util.*; /* Name of the class has to be "Main" only if the class is public. */ public final class Main { public static void main(String[] args) throws java.lang.Exception { // your code goes here Scanner s ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19]]
3
121
k = int(input()) l = str(input()) if k == len(l): print(l) else: print(l[0:k]+"...")
k = int(input()) l = str(input()) if k >= len(l): print(l) else: print(l[:k]+"...")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 3, 4, 0, 657, 31, 206, 206, 663, 0, 612]]
5
43
#include <iostream> #include <string> int main() { std::string str, str2; int k; std::cin >> k >> str; if (str.size() <= k) { std::cout << str << std::endl; } else { str2 = "..."; std::cout << str[0] + str2 << std::endl; } }
#include <iostream> #include <string> int main() { std::string str, str2; int k; std::cin >> k >> str; if (str.size() <= k) { std::cout << str << std::endl; } else { str2 = "..."; std::cout << str.substr(0, k) + str2 << std::endl; } }
[["-", 31, 16, 12, 16, 31, 69, 341, 342, 0, 70], ["+", 31, 16, 12, 16, 31, 2, 63, 118, 17, 131], ["+", 31, 16, 12, 16, 31, 2, 63, 118, 119, 120], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["-", 31, 16, 12, 16, 31, 69, 341, 342, 0, 73], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 21], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 22...
1
74
k=int(input()) s=input() if len(s)<=k: print(s) else: print(s[1:k+1]+"...")
k=int(input()) s=input() if len(s)<=k: print(s) else: print(s[0:k]+"...")
[["-", 3, 4, 0, 657, 31, 206, 206, 663, 0, 612], ["+", 3, 4, 0, 657, 31, 206, 206, 663, 0, 612], ["-", 0, 657, 31, 206, 206, 663, 0, 657, 17, 72], ["-", 0, 657, 31, 206, 206, 663, 0, 657, 12, 612]]
5
42
k=input() str=input() if len(str)>=int(k): print(str[:int(k)]+'...') else: print(str)
k=input() str=input() if len(str)>int(k): print(str[:int(k)]+'...') else: print(str)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
42
K = gets.to_i S = gets.chomp if S.length > K puts S[0..K-1] else puts S[0..K-1] + '...' end
K = gets.to_i S = gets.chomp if S.length <= K puts S[0..K-1] else puts S[0..K-1] + '...' end
[["-", 36, 36, 0, 493, 0, 121, 15, 738, 17, 47], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 19]]
4
40
k = int(input()) s = input() if len(s) > 7: print("{}...".format(s)) else: print(s)
k = int(input()) s = input() if len(s) > k: print("{}...".format(s[0:k])) else: print(s)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 102], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 206, 0, 73]]
5
38
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define YES() printf("YES\n") #define NO() printf("NO\n") #define Yes() printf("Yes\n") #define No() printf("No\n") #define ll long long #define ld long double #define pb push_back #define MOD 1000000007 #define LLMN LONG_LONG_MIN #def...
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define YES() printf("YES\n") #define NO() printf("NO\n") #define Yes() printf("Yes\n") #define No() printf("No\n") #define ll long long #define ld long double #define pb push_back #define MOD 1000000007 #define LLMN LONG_LONG_MIN #def...
[["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35], ["+", 0, 57, 75, 76, 0, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
595
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k; cin >> s; long long i, a; if (s.size() >= k) { for (i = 0; i < k; i++) { cout << s[i]; } cout << "..." << endl; } else { cout << s; } }
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k; cin >> s; long long i, a; if (s.size() > k) { for (i = 0; i < k; i++) { cout << s[i]; } cout << "..." << endl; } else { cout << s; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
81
k = input() s = input() if int(k) > len(s): print(s) else: print(s[:int(k)]+'...')
k = input() s = input() if int(k) >= len(s): print(s) else: print(s[:int(k)]+'...')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
42
k=int(input()) s=str(input()) if len(s)<=k: print(s) exit() else: print(s[0:k-1]+"...")
k=int(input()) s=str(input()) if len(s)<=k: print(s) exit() else: print(s[0:k]+"...")
[["-", 0, 657, 31, 206, 206, 663, 0, 657, 17, 33], ["-", 0, 657, 31, 206, 206, 663, 0, 657, 12, 612]]
5
48
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); String s = scan.next().toLowerCase(); int k = s.length(); if (n == k) System.out.println(s); else { String ss = s.substring(0, n);...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); String s = scan.next().toLowerCase(); int k = s.length(); if (n >= k) System.out.println(s); else { String ss = s.substring(0, n);...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 60], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20]]
3
109
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int k; cin >> k; string s; cin >> s; int ss = s.size(); if (k > ss) { cout << s << endl; } else { for (int i = 0; i < min(k, ss); i++) { cout << s[i]; ...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int k; cin >> k; string s; cin >> s; int ss = s.size(); if (k >= ss) { cout << s << endl; } else { for (int i = 0; i < min(k, ss); i++) { cout << s[i]; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
114
nb = int(input()) sentence = input() if len(sentence) > nb: print(sentence[0:nb-1] + '...') else: print(sentence)
nb = int(input()) sentence = input() if len(sentence) > nb: print(sentence[0:nb] + '...') else: print(sentence)
[["-", 0, 657, 31, 206, 206, 663, 0, 657, 17, 33], ["-", 0, 657, 31, 206, 206, 663, 0, 657, 12, 612]]
5
42
#include <bits/stdc++.h> using namespace std; #define int long long #define ld long double #define fi first #define se second #define pb push_back #define mp make_pair #define mt make_tuple #define fo(i, n) for (i = 0; i < n; i++) #define fo1(i, n) for (i = 1; i <= n; i++) #define Fo(i, k, n) for (i = k; k <= n ? i <=...
#include <bits/stdc++.h> using namespace std; #define int long long #define ld long double #define fi first #define se second #define pb push_back #define mp make_pair #define mt make_tuple #define fo(i, n) for (i = 0; i < n; i++) #define fo1(i, n) for (i = 1; i <= n; i++) #define Fo(i, k, n) for (i = k; k <= n ? i <=...
[["-", 31, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["-", 31, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["-", 0, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
728
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int K; string S; cin >> K; cin >> S; if (S.size() > K) { for (int i = 0; i < (K - 1); i++) { cout << S[i]; } cout << "..." << '\n'; } else if (S.size() <= K) { cout << S << '\n'...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int K; string S; cin >> K; cin >> S; if (S.size() > K) { for (int i = 0; i < K; i++) { cout << S[i]; } cout << "..." << '\n'; } else if (S.size() <= K) { cout << S << '\n'; } ...
[["-", 64, 9, 0, 7, 15, 16, 12, 23, 0, 24], ["-", 0, 7, 15, 16, 12, 23, 0, 16, 17, 33], ["-", 0, 7, 15, 16, 12, 23, 0, 16, 12, 13], ["-", 64, 9, 0, 7, 15, 16, 12, 23, 0, 25]]
1
110
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] + '...')
[["+", 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
38
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> s; int x = s.size(); if (x > k) { for (int i = 0; i < k; i++) { cout << s.at(i); } cout << "..." << endl; } else { cout << s << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k >> s; int x = s.size(); if (x > k) { for (int i = 0; i < k; i++) { cout << s.at(i); } cout << "..." << endl; } else { cout << s << endl; } }
[["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152]]
1
81
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // int K = Integer.parseInt(sc.nextLine()); int K = sc.nextInt(); String S = sc.next(); // System.out.println("aaa\n"); if (S.length() <= K) { System.out...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // int K = Integer.parseInt(sc.nextLine()); int K = sc.nextInt(); String S = sc.next(); // System.out.println("aaa\n"); if (S.length() <= K) { System.out...
[["-", 3, 4, 0, 16, 31, 492, 3, 4, 0, 499], ["+", 3, 4, 0, 16, 31, 492, 3, 4, 0, 22]]
3
99
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(); if (K <= S.length()) { System.out.println(S); } else { String[] ss = S.split(""); for (int i = 0; i < K; i++) { ...
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(); if (K >= S.length()) { System.out.println(S); } else { String[] ss = S.split(""); for (int i = 0; i < K; i++) { ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20]]
3
129
#define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k >> s; if (s.size() >= k) { cout << s.substr(0, k) << "..." << endl; } else { cout << s << endl; } }
#define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k >> s; if (s.size() > k) { cout << s.substr(0, k) << "..." << endl; } else { cout << s << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
72
k = gets.to_i s = gets if s.length <= k puts s else puts s.slice(0,k) + '...' end
k = gets.to_i s = gets.chomp if s.length <= k puts s else puts s.slice(0,k) + '...' end
[["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]]
4
31
#include <bits/stdc++.h> using namespace std; int main() { int k; cin >> k; string str; cin >> str; if (str.size() == k) cout << str << endl; else { for (int i = 0; i < k; i++) cout << str[i]; cout << "...\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int k; cin >> k; string str; cin >> str; if (str.size() <= k) cout << str << endl; else { for (int i = 0; i < k; i++) cout << str[i]; cout << "...\n"; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
76
import sys k = int(sys.stdin.readline().rstrip()) s = sys.stdin.readline().rstrip() l = len(s) if l < k: print(s) else: print(s[:k] + "...")
import sys k = int(sys.stdin.readline().rstrip()) s = sys.stdin.readline().rstrip() l = len(s) if l <= 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
60
#include <algorithm> #include <cmath> #include <iostream> #include <stdio.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; /* a と b の最大公約数を返す関数 */ long long GCD(long long a, long long b) { if (b == 0) retu...
#include <algorithm> #include <cmath> #include <iostream> #include <stdio.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; /* a と b の最大公約数を返す関数 */ long long GCD(long long a, long long b) { if (b == 0) retu...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
138
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0); cin.tie(0); int k; cin >> k; string s; cin >> s; int n = s.size(); if (n <= k) { cout << s << '\n'; } else { cout << s.substr(0, 7) << "..."; } return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0); cin.tie(0); int k; cin >> k; string s; cin >> s; int n = s.size(); if (n <= k) { cout << s << '\n'; } else { cout << s.substr(0, k) << "..."; } return 0; }
[["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22]]
1
91
import sys input = sys.stdin.readline #input = sys.stdin.buffer.readline #sys.setrecursionlimit(10**9) #from functools import lru_cache def RD(): return sys.stdin.read() def II(): return int(input()) def MI(): return map(int,input().split()) def MF(): return map(float,input().split()) def LI(): return list(map(int,i...
import sys input = sys.stdin.readline #input = sys.stdin.buffer.readline #sys.setrecursionlimit(10**9) #from functools import lru_cache def RD(): return sys.stdin.read() def II(): return int(input()) def MI(): return map(int,input().split()) def MF(): return map(float,input().split()) def LI(): return list(map(int,i...
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 72], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
189
K=int(input()) S=input() if len(S)<=K:print(S) else:print(S[0:K-1]+'...')
K=int(input()) S=input() if len(S)<=K:print(S) else:print(S[0:K]+'...')
[["-", 0, 657, 31, 206, 206, 663, 0, 657, 17, 33], ["-", 0, 657, 31, 206, 206, 663, 0, 657, 12, 612]]
5
42
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k; cin >> s; if (sizeof(s) > k) { s = s.substr(0, k) + "..."; } cout << s << '\n'; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k; cin >> s; if (s.size() > k) { s = s.substr(0, k) + "..."; } cout << s << '\n'; return 0; }
[["-", 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
63
k = gets.to_i s = gets if s.length > k print s[0..(k-1)] + '...' else print s[0..(k-1)] end
k = gets.chomp.to_i s = gets.chomp if s.length > k print s[0..(k-1)] + '...' else print s[0..(k-1)] end
[["+", 0, 493, 0, 662, 12, 652, 486, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]]
4
42
"use strict"; const main = (arg) => { const array = arg.trim().split("\n"); let K = parseInt(array[0]); let S = array[1]; if (S.length < K) { console.log(S); } else { let result = S.substr(0, K); console.log(result + "..."); } }; main(require("fs").readFileSync("/dev/stdin", "utf8")); // main(...
"use strict"; const main = (arg) => { const array = arg.trim().split("\n"); let K = parseInt(array[0]); let S = array[1]; if (S.length <= K) { console.log(S); } else { let result = S.substr(0, K); console.log(result + "..."); } }; main(require("fs").readFileSync("/dev/stdin", "utf8")); // main...
[["-", 8, 556, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 556, 0, 57, 15, 23, 0, 16, 17, 19]]
2
115
K = int(input()) S = input() if len(S) >= K: print(S[0:K] + "...") else: print(S)
K = int(input()) S = input() if len(S) > K: print(S[0:K] + "...") else: print(S)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
40
#N = gets.to_i # 単一整数 #a = gets.split.map(&:to_i) # スペースで区切られた複数の整数 #a = N.times.map{gets.to_i} # 縦に並んだ複数の整数。たまにある #S = gets.chomp # 文字列。chompを付けないと改行文字がついてくる def solve168A(n) last_n = n % 10 if last_n == 3 puts ('bon') elsif last_n == 2 or last_n == 4 \ or last_n == 5 or las...
#N = gets.to_i # 単一整数 #a = gets.split.map(&:to_i) # スペースで区切られた複数の整数 #a = N.times.map{gets.to_i} # 縦に並んだ複数の整数。たまにある #S = gets.chomp # 文字列。chompを付けないと改行文字がついてくる def solve168A(n) last_n = n % 10 if last_n == 3 puts ('bon') elsif last_n == 2 or last_n == 4 \ or last_n == 5 or las...
[["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]]
4
113
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(f'{S[:K]}...')
[["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 652, 3, 4, 0, 557, 0, 284, 0, 45], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 652, 3, 4, 0, 557, 0, 284, 0, 46]]
5
39
k=int(input()) s=str(input()) if len(s) < k:print(s) else:print(s[0:k:]+"...")
k=int(input()) s=str(input()) if len(s) <= k:print(s) else:print(s[0:k:]+"...")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
44
#include <bits/stdc++.h> using namespace std; // Author: Ezio Sam /* Shorthands */ #define ll long long #define pb push_back #define mp make_pair #define sp ": " #define cs "Case " #define fi first #define sn second #define po(x) x *x /* STL */ #define vi vector<int> v #define pii pair<int, int> #define pll pair<ll, ll...
#include <bits/stdc++.h> using namespace std; // Author: Ezio Sam /* Shorthands */ #define ll long long #define pb push_back #define mp make_pair #define sp ": " #define cs "Case " #define fi first #define sn second #define po(x) x *x /* STL */ #define vi vector<int> v #define pii pair<int, int> #define pll pair<ll, ll...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
195
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define MOD 1000000007 #define mod9 1000000009 #define fast \ ios_base ::sync_with_stdio(0); \ cin.tie(NULL); ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define MOD 1000000007 #define mod9 1000000009 #define fast \ ios_base ::sync_with_stdio(0); \ cin.tie(NULL); ...
[["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35], ["+", 0, 57, 75, 76, 0, 9, 0, 37, 0, 38]]
1
766
#include <bits/stdc++.h> using namespace std; int main() { int k, i, j, t; string s; cin >> s; if (s.size() <= k) cout << s; else { for (i = 0; i < k; i++) cout << s[i]; cout << "..."; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int k, i, j, t; string s; cin >> k >> s; if (s.size() <= k) cout << s; else { for (i = 0; i < k; i++) cout << s[i]; cout << "..."; } return 0; }
[["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152]]
1
74
k = int(input()) s = str(input()) l = len (s) if k < l: s = s[0:k] print(s,"...") else: print(s)
k = int(input()) s = str(input()) l = len (s) if k < l: s = s[0:k] print(s+"...") else: print(s)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
49
#include <bits/stdc++.h> using namespace std; int main() { string s; int k; cin >> s >> k; if (s.size() <= k + 1) { cout << s << endl; return 0; } else { for (int i = 0; i < k; i++) { cout << s.at(i); } cout << "..." << endl; return 0; } }
#include <bits/stdc++.h> using namespace std; int main() { string s; int k; cin >> k >> s; if (s.size() <= k) { cout << s << endl; return 0; } else { for (int i = 0; i < k; i++) { cout << s.at(i); } cout << "..." << 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], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
86
#include <bits/stdc++.h> using namespace std; int main() { int K; string S; cin >> K >> S; if (K > S.size()) { cout << S << endl; return 0; } else { for (int i = 0; i < K; i++) { cout << S.at(i); } cout << "..." << endl; return 0; } }
#include <bits/stdc++.h> using namespace std; int main() { int K; string S; cin >> K; cin >> S; if (K >= S.size()) { cout << S << endl; return 0; } else { for (int i = 0; i < K; i++) { cout << S.at(i); } cout << "..." << endl; return 0; } }
[["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
84
K = int(input()) S = input() cnt = '...' if len(S) <= K: print(S) else: print(S[:7] + str(cnt))
K = int(input()) S = input() cnt = '...' if len(S) <= K: print(S) else: print(S[:K] + str(cnt))
[["-", 3, 4, 0, 657, 31, 206, 206, 663, 0, 612], ["+", 3, 4, 0, 657, 31, 206, 206, 663, 0, 22]]
5
45
"use strict" const assert = require('assert'); function main(input) { let ret = check(input); console.log(ret); } function check(input) { let ans; let [k, s] = input.split("\n"); k = parseInt(k); if (s.length < k) { ans = s; } else if (s.length >= k) { let sliceS = s.slice(0, k) + "..."; ans...
"use strict" const assert = require('assert'); function main(input) { let ret = check(input); console.log(ret); } function check(input) { let ans; let [k, s] = input.split("\n"); k = parseInt(k); if (s.length <= k) { ans = s; } else if (s.length > k) { let sliceS = s.slice(0, k) + "..."; ans...
[["-", 8, 556, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 556, 0, 57, 15, 23, 0, 16, 17, 19], ["-", 75, 76, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 75, 76, 0, 57, 15, 23, 0, 16, 17, 47]]
2
154
#!/usr/bin/env ruby N = gets.to_i S = gets.to_s if S.size < N puts S else puts S.slice!(0, N) + "..." end
#!/usr/bin/env ruby N = gets.to_i S = gets.chomp.to_s if S.size <= N puts S else puts S.slice!(0, N) + "..." end
[["+", 0, 493, 0, 662, 12, 652, 486, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["-", 36, 36, 0, 493, 0, 121, 15, 738, 17, 18], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 19]]
4
34
#include <iostream> #include <string> int main() { std::string K, K_cut; int S; std::cin >> S >> K; if (K.length() > S) { K_cut = K.substr(1, S); std::cout << K_cut << "..." << std::endl; } else { std::cout << K << std::endl; } }
#include <iostream> #include <string> int main() { std::string K, K_cut; int S; std::cin >> S >> K; if ((int)K.length() > S) { K_cut = K.substr(0, S); std::cout << K_cut << "..." << std::endl; } else { std::cout << K << std::endl; } }
[["+", 0, 57, 15, 339, 51, 16, 31, 74, 0, 24], ["+", 15, 339, 51, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 57, 15, 339, 51, 16, 31, 74, 0, 25], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13]]
1
78
K = int(input()) S = str(input()) deffirence = len(S) - K if deffirence > 0: print(S[0: K:]) else: print(S)
K = int(input()) S = str(input()) deffirence = len(S) - K if deffirence > 0: print(S[0: K:] + '...') else: print(S)
[["+", 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
45
K = int(input()) S = input() if(len(S)>K): for i in range(K): print(S[i],end="") print(". . .") else: print(S)
K = int(input()) S = input() if(len(S)>K): for i in range(K): print(S[i],end="") print("...") else: print(S)
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
55
K = gets.to_i S = gets if S.length <= K puts S else ans = S.slice(0, K) puts(ans+"...") end
K = gets.to_i S = gets if S.length <= K+1 puts S else ans = S.slice(0, K) puts(ans+"...") end
[["+", 0, 493, 0, 121, 15, 738, 12, 738, 17, 72], ["+", 0, 493, 0, 121, 15, 738, 12, 738, 12, 612]]
4
36
<?php fscanf(STDIN, "%d", $k); fscanf(STDIN, "%s", $s); $output; if ($k < strlen($s)) { $output = substr($s, 0, 7) . '...'; } else { $output = $s; } echo $output;
<?php fscanf(STDIN, "%d", $k); fscanf(STDIN, "%s", $s); $output; if ($k < strlen($s)) { $output = substr($s, 0, $k) . '...'; } else { $output = $s; } echo $output;
[["-", 12, 16, 31, 613, 3, 3, 0, 28, 0, 612], ["+", 31, 613, 3, 3, 0, 28, 0, 606, 0, 607], ["+", 31, 613, 3, 3, 0, 28, 0, 606, 0, 141]]
6
71
#include <bits/stdc++.h> using namespace std; int main() { int K; cin >> K; char S[101] = {'\0'}; cin >> S; int count = 0; for (int i = 0; S[i] != '\0'; i++) count++; if (count < K) { cout << S; } else { for (int i = 0; i < K; i++) cout << S[i]; cout << "..." << endl; } re...
#include <bits/stdc++.h> using namespace std; int main() { int K; cin >> K; char S[101] = {'\0'}; cin >> S; int count = 0; for (int i = 0; S[i] != '\0'; i++) count++; if (count <= K) { cout << S; } else { for (int i = 0; i < K; i++) cout << S[i]; cout << "..." << endl; } r...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
109
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iostream> // cout, endl, cin ...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iostream> // cout, endl, cin ...
[["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["-", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
123
/* 7 nikoandsolstice */ function main(input) { input = input.trim(); var ten = "..." var jisuu = input.split("\n")[0]; var moji = input.split("\n")[0]; if (moji.length > jisuu) { console.log(moji.substr(0, jisuu) + ten); } else { console.log(moji); } } main(require("fs").readFileSync("/dev/stdin"...
/* 7 nikoandsolstice */ function main(input) { input = input.trim(); var ten = "..." var jisuu = input.split("\n")[0]; var moji = input.split("\n")[1]; if (moji.length > jisuu) { console.log(moji.substr(0, jisuu) + ten); } else { console.log(moji); } } main(require("fs").readFileSync("/dev/stdin"...
[["-", 8, 556, 0, 198, 0, 200, 51, 69, 71, 555], ["+", 8, 556, 0, 198, 0, 200, 51, 69, 71, 555]]
2
109
k=gets.to_i s=gets.chomp p s.length if k>=s.length puts s else line=[] line.push(s.chars) ary=[] k.times do |i| ary[i]=line[0][i] end if k<s.length ary.push('...') end puts str = ary.join end
k=gets.to_i s=gets.chomp s.length if k>=s.length puts s else line=[] line.push(s.chars) ary=[] k.times do |i| ary[i]=line[0][i] end if k<s.length ary.push('...') end puts str = ary.join end
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]]
4
81
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <sstream> #include <string.h> #include <string> #include <vector> using namespace std; #define IOS \ ios::sync_with_stdio(0); ...
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <sstream> #include <string.h> #include <string> #include <vector> using namespace std; #define IOS \ ios::sync_with_stdio(0); ...
[["+", 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
108
K=int(input()) S=input() if len(S)<=K: print(S) else: T=[] S=list(S) for i in range(K): T.append(S[i]) K="".join(T) print(K,"...")
K=int(input()) S=input() if len(S)<=K: print(S) else: T=[] S=list(S) for i in range(K): T.append(S[i]) K="".join(T) print(K+"...")
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
71
#include <iostream> #include <vector> using namespace std; // cin, coutを使う int main() { int K; string S; cin >> K >> S; if (K > S.size()) { cout << S << endl; } else { cout << S.substr(0, K) + "..." << endl; } }
#include <iostream> #include <vector> using namespace std; // cin, coutを使う int main() { int K; string S; cin >> K >> S; if (K >= S.size()) { cout << S << endl; } else { cout << S.substr(0, K) + "..." << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
65
<?php $maxLength = trim(fgets(STDIN)); $input = trim(fgets(STDIN)); $inputLength = strlen($input); if ($maxLength <= $inputLength) { $input = substr($input, 0, $maxLength)."..."; } echo $input;
<?php $maxLength = trim(fgets(STDIN)); $input = trim(fgets(STDIN)); $inputLength = strlen($input); if ($maxLength < $inputLength) { $input = substr($input, 0, $maxLength)."..."; } echo $input."\n";
[["-", 0, 493, 0, 57, 15, 23, 0, 16, 17, 19], ["+", 0, 493, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 36, 36, 0, 493, 0, 608, 0, 16, 17, 131], ["+", 0, 493, 0, 608, 0, 16, 12, 609, 0, 62], ["+", 0, 493, 0, 608, 0, 16, 12, 609, 0, 44]]
6
64
k = int(input()) s = str(input()) if k < len(s): ans = s[0:k+1]+'...' print(ans) else: print(s)
k = int(input()) s = str(input()) if k < len(s): ans = s[0:k]+'...' print(ans) else: print(s)
[["-", 12, 657, 31, 206, 206, 663, 0, 657, 17, 72], ["-", 12, 657, 31, 206, 206, 663, 0, 657, 12, 612]]
5
48
#include <bits/stdc++.h> #include <cmath> #include <string.h> using namespace std; int main() { string s; long long int k; cin >> k >> s; if ((s.length()) <= k) cout << s << "\n"; else cout << s.substr(0, (k - 1)) + "..." << "\n"; }
#include <bits/stdc++.h> #include <cmath> #include <string.h> using namespace std; int main() { string s; long long int k; cin >> k >> s; if ((s.length()) <= k) cout << s << "\n"; else cout << s.substr(0, k) + "..." << "\n"; }
[["-", 12, 16, 31, 2, 3, 4, 0, 23, 0, 24], ["-", 31, 2, 3, 4, 0, 23, 0, 16, 17, 33], ["-", 31, 2, 3, 4, 0, 23, 0, 16, 12, 13], ["-", 12, 16, 31, 2, 3, 4, 0, 23, 0, 25]]
1
74
n = gets.chomp.to_i s = gets.chomp.to_s if n >= s.length puts s else puts s[0..n-1] end
n = gets.chomp.to_i s = gets.chomp.to_s if n >= s.length puts s else puts s[0..n-1] + '...' end
[["+", 75, 95, 0, 652, 3, 4, 0, 738, 17, 72], ["+", 0, 652, 3, 4, 0, 738, 12, 557, 0, 62], ["+", 0, 652, 3, 4, 0, 738, 12, 557, 0, 6]]
4
33
K = int(input()) S = input() L = len(S) print(S if K >= L else S[:L] + '...')
K = int(input()) S = input() L = len(S) print(S if K >= L else S[:K] + '...')
[["-", 0, 41, 0, 657, 31, 206, 206, 663, 0, 22], ["+", 0, 41, 0, 657, 31, 206, 206, 663, 0, 22]]
5
37
#include <iostream> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL); int K; std::cin >> K; std::string S; std::cin >> S; if (S.length() <= K) std::cout << K << "\n"; else { for (int i = 0; i < K; ++i) std::cout << S[i]; std::cout << "...\...
#include <iostream> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL); int K; std::cin >> K; std::string S; std::cin >> S; if (S.length() <= K) std::cout << S << "\n"; else { for (int i = 0; i < K; ++i) std::cout << S[i]; std::cout << "...\...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22]]
1
113
#include <stdio.h> #include <string.h> int main() { char kalimat[100]; int limit; scanf("%d\n%[^\n]", &limit, &kalimat); int length = strlen(kalimat); if (length <= limit) { printf("%s", kalimat); } else { for (int a = 0; a < limit; a++) { printf("%c", kalimat[a]); puts("..."); } ...
#include <stdio.h> #include <string.h> int main() { char kalimat[100]; int limit; scanf("%d\n%[^\n]", &limit, &kalimat); int length = strlen(kalimat); if (length <= limit) { printf("%s", kalimat); } else { for (int a = 0; a < limit; a++) { printf("%c", kalimat[a]); } puts("..."); }...
[["+", 75, 76, 0, 9, 0, 7, 8, 9, 0, 46], ["-", 75, 76, 0, 9, 0, 7, 8, 9, 0, 46]]
1
102
n=gets.to_i s=gets.chomp puts s.size>n ? s[0,7]+"..." : s
n=gets.to_i s=gets.chomp puts s.size>n ? s[0,n]+"..." : s
[["-", 3, 4, 0, 754, 64, 738, 31, 742, 0, 612], ["+", 3, 4, 0, 754, 64, 738, 31, 742, 0, 22]]
4
29
n=int(input()) txt=input() # print(type(n)) if len(txt)<n: print(txt) else: print("%s..."%txt[:n])
n=int(input()) txt=input() # print(type(n)) if len(txt)<=n: print(txt) else: print("%s..."%txt[:n])
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
40
k = gets.to_i s = gets.chomp if k > s.length puts s else puts "#{s[0..k-1]}..." end
k = gets.to_i s = gets.chomp if k >= s.length puts s else puts "#{s[0..k-1]}..." end
[["-", 36, 36, 0, 493, 0, 121, 15, 738, 17, 47], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 20]]
4
34
k = int(input()) s = input() l = len(s) if l > k: print(s[0:7] + '...') else: print(s)
k = int(input()) s = input() l = len(s) if l > k: print(s[0:k] + '...') else: print(s)
[["-", 3, 4, 0, 657, 31, 206, 206, 663, 0, 612], ["+", 3, 4, 0, 657, 31, 206, 206, 663, 0, 22]]
5
43
k = int(input()) s = str(input()) if len(s) > k: print(s[:k] + '...')
k = int(input()) s = str(input()) if len(s) > k: s = s[:k] + '...' print(s)
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 1, 0, 662, 12, 657, 31, 206, 51, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
5
36
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; ++i) #define FOR(i, a, b) for (int i = a; i < (int)b; ++i) #define rrep(i, n) for (int i = ((int)n - 1); i >= 0; --i) using ll = long long; using ld = long double; const ll INF = 1e18; const int Inf = 1e9; const double EPS =...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; ++i) #define FOR(i, a, b) for (int i = a; i < (int)b; ++i) #define rrep(i, n) for (int i = ((int)n - 1); i >= 0; --i) using ll = long long; using ld = long double; const ll INF = 1e18; const int Inf = 1e9; const double EPS =...
[["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["-", 75, 76, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62]]
1
143
def answer(k:int, s:str) -> str: if len(s) <= k: return s else: return s[:(k-1)] + '...' k = int(input()) s = input() print(answer(k, s))
def answer(k:int, s:str) -> str: if len(s) <= k: return s else: return s[:k] + '...' k = int(input()) s = input() print(answer(k, s))
[["-", 0, 657, 31, 206, 206, 663, 0, 23, 0, 24], ["-", 31, 206, 206, 663, 0, 23, 0, 657, 17, 33], ["-", 31, 206, 206, 663, 0, 23, 0, 657, 12, 612], ["-", 0, 657, 31, 206, 206, 663, 0, 23, 0, 25]]
5
62
# S の長さが K 以下であれば、S をそのまま出力してください。 # S の長さが K を上回っているならば、 # 先頭 K 文字だけを切り出し、末尾に ... を付加して出力してください。 # K は 1 以上 100 以下の整数 # S は英小文字からなる文字列 # S の長さは 1 以上 100 以下 K = int(input()) S = str(input()) if K >= len(S): print(K) else: print((S[0:K] + '...'))
# S の長さが K 以下であれば、S をそのまま出力してください。 # S の長さが K を上回っているならば、 # 先頭 K 文字だけを切り出し、末尾に ... を付加して出力してください。 # K は 1 以上 100 以下の整数 # S は英小文字からなる文字列 # S の長さは 1 以上 100 以下 K = int(input()) S = str(input()) if K >= len(S): print(S) else: print((S[0:K] + '...'))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
51
n = int(input()) if n < 1 or n > 100: exit() n1 = input() i = len(n1) if i < 1 or i > 100: exit() n2 = '...' if n > i: print(n1) else: print(n1[:n] + n2)
n = int(input()) if n < 1 or n > 100: exit() n1 = input() i = len(n1) if i < 1 or i > 100: exit() n2 = '...' if n >= i: print(n1) else: print(n1[:n] + n2)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
69
#include <bits/stdc++.h> using namespace std; int main() { int K; string S; cin >> K >> S; if (S.size() <= K) { cout << S << endl; return 0; } string T = S.substr(0, K); cout << T << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int K; string S; cin >> K >> S; if (S.size() <= K) { cout << S << endl; return 0; } string T = S.substr(0, K); T += "..."; cout << T << endl; }
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 1, 0, 11, 12, 5, 0, 62], ["+", 8, 9, 0, 1, 0, 11, 12, 5, 0, 6], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
63
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define MOD 1000000007 #define oo 1000000000000000000 #define forr(i, n) for (ll i = 0; i < n; i++) #define fastio \ ios_base:...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define MOD 1000000007 #define oo 1000000000000000000 #define forr(i, n) for (ll i = 0; i < n; i++) #define fastio \ ios_base:...
[["-", 64, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["+", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 28, 22], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 17, 131], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 119, 120], ["-", 0, 7, 15, 16, 12, 2, 3, 4, 0, 24], ["-", 0, 7, 15, 16, 12, 2, 3, 4, 0, 25], ["+", 0, 57...
1
368
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define sp " " #define endl "\n" #define MAX 10e9 #define MAXN 100001 #define mod 1000000007 #define inf_int 2e9 #define inf_ll 2e18 #define e 1e-9 #define vi vector<int> #define vl vector<ll> #define vc vector<char> #define vs vector<string> #define vpl vector<pair<...
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define sp " " #define endl "\n" #define MAX 10e9 #define MAXN 100001 #define mod 1000000007 #define inf_int 2e9 #define inf_ll 2e18 #define e 1e-9 #define vi vector<int> #define vl vector<ll> #define vc vector<char> #define vs vector<string> #define vpl vector<pair<...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
349
#include <bits/stdc++.h> using namespace std; int main() { int K; string S; cin >> K; cin >> S; for (int i = 0; i < S.length(); i++) { if (i >= K) { cout << "."; } else { cout << S[i]; } } }
#include <bits/stdc++.h> using namespace std; int main() { int K; string S; cin >> K; cin >> S; for (int i = 0; i < S.length(); i++) { if (i >= K) { cout << "..."; break; } else { cout << S[i]; } } }
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
70
#K is an input for the range of S #input from user to get lowercase the letters K = int(input()) S = input() if len(S) > K: print(S[:K] + ".....") else: print(S)
#K is an input for the range of S #input to get lowercase the letters from users K = int(input()) S = input() if len (S) > K: print(S[:K] + "...") else: print(S)
[["-", 0, 652, 3, 4, 0, 657, 12, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 12, 557, 0, 6]]
5
41
K=int(input()) S=input() if len(S)<=K: print(S) else: print(S[0:K])
K=int(input()) S=input() if len(S)<=K: print(S) else: print(S[0:K]+'...')
[["+", 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
36
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> s; if (s.size() > k) return cout << s << endl, 0; cout << s.substr(0, k) << "..." << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k >> s; if (s.size() <= k) return cout << s << endl, 0; cout << s.substr(0, k) << "..." << endl; }
[["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
58
k = int(input()) s = input() print(s if len(s) < k else s[0:k]+"...")
k = int(input()) s = input() print(s if len(s) <= k else s[0:k]+"...")
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 18], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 19]]
5
35
#include <bits/stdc++.h> #define repr(i, a, b) for (int i = a; i < b; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define reprrev(i, a, b) for (int i = b - 1; i >= a; i--) // [a, b) #define reprev(i, n) reprrev(i, 0, n) #define _GLIBCXX_DEBUG using ll = long long; using ull = unsigned long long; template <class...
#include <bits/stdc++.h> #define repr(i, a, b) for (int i = a; i < b; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define reprrev(i, a, b) for (int i = b - 1; i >= a; i--) // [a, b) #define reprev(i, n) reprrev(i, 0, n) #define _GLIBCXX_DEBUG using ll = long long; using ull = unsigned long long; template <class...
[["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
387
K = int(input()) S = str(input()) if K > len(S): print(S) else: print(S[0:K] + '...')
K = int(input()) S = str(input()) if K >= len(S): 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 = str(input()) if (len(s)) <= k: print(s) else: print(s[:7] + "...")
k = int(input()) s = str(input()) if len(s) <= k: print(s) else: print(s[:k] + "...")
[["-", 0, 656, 0, 57, 15, 666, 0, 23, 0, 24], ["-", 15, 666, 0, 23, 0, 652, 3, 4, 0, 25], ["-", 3, 4, 0, 657, 31, 206, 206, 663, 0, 612], ["+", 3, 4, 0, 657, 31, 206, 206, 663, 0, 22]]
5
44
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; int main() { int K; string S; cin >> K >> S; if (S.size() <= K) cout << S << endl; else S = S.substr(0, K); cout << S + "..." << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; int main() { int K; string S; cin >> K >> S; if (S.size() <= K) cout << S << endl; else { S = S.substr(0, K); cout << S + "..." << endl; } return 0; }
[["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
79
#include <bits/stdc++.h> using namespace std; #define print cout << #define printl(s) cout << s << endl; #define rep(i, n) for (int i = 0; i < (n); ++i) template <typename T> vector<T> getValues(int num) { vector<T> values(num); for (int i = 0; i < num; i++) { cin >> values.at(i); } return values; } int ...
#include <bits/stdc++.h> using namespace std; #define print cout << #define printl(s) cout << s << endl; #define rep(i, n) for (int i = 0; i < (n); ++i) template <typename T> vector<T> getValues(int num) { vector<T> values(num); for (int i = 0; i < num; i++) { cin >> values.at(i); } return values; } int ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
135
''' 問題: 英小文字からなる文字列 S があります。 S の長さが K 以下であれば、Sをそのまま出力してください。 S の長さが K を上回っているならば、先頭 K 文字だけを切り出し、 末尾に ... を付加して出力してください。 ''' ''' 制約: K は 1 以上 100 以下の整数 S は英小文字からなる文字列 S の長さは 1 以上 100 以下 ''' # 標準入力からK, S を取得する k = int(input()) s = str(input()) result = "" if len(s) <= k: result = s els...
''' 問題: 英小文字からなる文字列 S があります。 S の長さが K 以下であれば、Sをそのまま出力してください。 S の長さが K を上回っているならば、先頭 K 文字だけを切り出し、 末尾に ... を付加して出力してください。 ''' ''' 制約: K は 1 以上 100 以下の整数 S は英小文字からなる文字列 S の長さは 1 以上 100 以下 ''' # 標準入力からK, S を取得する k = int(input()) s = str(input()) result = "" if len(s) <= k: result = s els...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
67
# B - ... (Triple Dots) # K K = int(input()) # S S = input() if K > len(S): answer = S else: answer = S[0:K] + '...' print(answer)
# B - ... (Triple Dots) # K K = int(input()) # S S = input() if K >= len(S): answer = S else: answer = S[0:K] + '...' print(answer)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
45
K = int(input()) S = str(input()) SK = S[0 : (K)] if len(S) <= K: answer = S else: print(SK + '...')
K = int(input()) S = str(input()) SK = S[0 : (K)] if len(S) <= K: print(S) else: print(SK + '...')
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
47
#include <stdio.h> #include <string.h> int main() { int k, m, l; char s[101], c[101]; scanf("%d", &k); scanf("%s", s); m = strlen(s); if (m <= k) { printf("%s", s); } else { strncpy(c, s, m); c[m] = '.'; c[m + 1] = '.'; c[m + 2] = '.'; c[m + 3] = '\0'; printf("%s", c); }...
#include <stdio.h> #include <string.h> int main() { int k, m, l; char s[101], c[101]; scanf("%d", &k); scanf("%s", s); m = strlen(s); if (m <= k) { printf("%s", s); } else { strncpy(c, s, k); c[k] = '.'; c[k + 1] = '.'; c[k + 2] = '.'; c[k + 3] = '\0'; printf("%s", c); }...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 9, 0, 1, 0, 11, 31, 69, 71, 22], ["+", 0, 9, 0, 1, 0, 11, 31, 69, 71, 22], ["-", 0, 1, 0, 11, 31, 69, 71, 16, 31, 22], ["+", 0, 1, 0, 11, 31, 69, 71, 16, 31, 22]]
0
137
#168b #値を受け取る K = int(input()) S = str(input()) #Kになるまで文字を取り、K以降の文字列は'…'で表す def answer(K: int, S: str) -> str: if len(S) <= K: return S else: return S[K:] + '...' print(answer(K, S))
#168b #値を受け取る K = int(input()) S = str(input()) #Kになるまで文字を取り、K以降の文字列は'…'で表す def answer(K: int, S: str) -> str: if len(S) <= K: return S else: return S[:K] + '...' print(answer(K, S))
[["-", 0, 37, 0, 657, 31, 206, 206, 663, 0, 22], ["+", 0, 37, 0, 657, 31, 206, 206, 663, 0, 22]]
5
64
length=int(input()) s=input() string = "" if len(s) < length: print(s) else: for i in range(0,length): string += s[i] string +="..." print(string)
length=int(input()) s=input() string = "" if len(s) <= length: print(s) else: for i in range(0,length): string += s[i] string +="..." print(string)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
56
K = int(input()) S = input() words = int(len(S)) if K <= words: print(S[0:K] + "...") else: print(S)
K = int(input()) S = input() words = int(len(S)) if K < words: print(S[0:K] + "...") else: print(S)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
46
#include <bits/stdc++.h> using namespace std; #define ll long long signed main() { int k; string s; cin >> k >> s; if (s.length() < k) { cout << s << "\n"; return 0; } else { cout << s.substr(0, k) << "..." << "\n"; } }
#include <bits/stdc++.h> using namespace std; #define ll long long signed main() { int k; string s; cin >> k >> s; if (s.length() <= k) { cout << s << "\n"; return 0; } else { cout << s.substr(0, k) << "..." << "\n"; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
72
#include <iostream> #include <string> using namespace std; int main() { int k; cin >> k; string s, S; cin >> s; if (s.length() <= k) cout << s; else for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..."; return 0; }
#include <iostream> #include <string> using namespace std; int main() { int k; cin >> k; string s, S; cin >> s; if (s.length() <= k) cout << s; else { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..."; } }
[["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
77
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #includ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
219
K = int(input()) S = input() if len(str(S)) < K: print(S) else: print(S[:K]+'...')
# 168 B K = int(input()) S = input() if len(str(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
42
#include <iostream> #include <stdio.h> #include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstring> #include <map> #include <string> #include <vector> using namespace std; int main() { string s; int k; cin >> k; cin >> s; if (s.size() > k) { s = s.substr(0, 7) + "......
#include <iostream> #include <stdio.h> #include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstring> #include <map> #include <string> #include <vector> using namespace std; int main() { string s; int k; cin >> k; cin >> s; if (s.size() > k) { s = s.substr(0, k) + "......
[["-", 0, 11, 12, 16, 31, 2, 3, 4, 0, 13], ["+", 0, 11, 12, 16, 31, 2, 3, 4, 0, 22]]
1
98